Drewcypher (drewcypher) wrote in component_help,
Drewcypher
drewcypher
component_help

Ordering Components

My code is cut and pasted from all over this site. Recently, I decided I'd like to have the tags component included. I got the code to work, I now have the tags. I don't like the placement. Ideally, my page would be set up with profile, navigation, calendar, links, page summary then tags. I also like the tags setup on the "Smooth Sailing" layout, where you have multiple tags per line. This seems to take up much less space than having to scroll them all line by line.

I'd appreciate any help you might have to offer. Thanks.

EDIT: SOLVED! THANKS FOR ALL THE HELP.



layerinfo "type" = "theme";

layerinfo "name" = "qwc 2";



function page_layout(Page p) {



  var string k1Swidth      = "100%";

  var string k1Sheader_url = "http://i3.photobucket.com/albums/y54/ravenclawdrew/rcdiariesqwc2.jpg";

  var string k1Sheader_alt = "The Ravenclaw Diaries";

  var string title = $p->title();





"""

  <html>

  <head>

    <link rel="stylesheet" href="$p.stylesheet_url" type="text/css"/>

    $p.head_content

    """; $p->print_custom_head(); """

    <title>The Ravenclaw Diaries</title>

  </head>

  """;

  



  """<body style="text-align:center;">""";



  if($k1Sheader_url != "") {

    """<div align="center"><img src="$k1Sheader_url" alt="$k1Sheader_alt" title="$k1Sheader_alt" /></div>""";

  }



  if($k1Swidth != "") {

    """<table style="border: 0px; margin: auto; padding: 0px; width:$k1Swidth;"><tr><td>""";

  }







  """<div><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></div>""";



  """

  <table cellspacing="0" cellpadding="0" valign="top">

    <tr valign="top" width="100%">

      <td width="3">

        <img src="$*PALIMGROOT/component/clear.gif" width="3" height="1" alt="" border="0" />

      </td>

  """;

  



  if ($*comp_state == "left") {

    print_my_components($p);

    """

    <td width="3">

      <img src="$*PALIMGROOT/component/clear.gif" width="3" height="1" alt="" border="0" />

    </td>

    """;

  }





  print_my_entries($p, $title);





  if ($*comp_state == "right") {

    """

    <td width="3">

      <img src="$*PALIMGROOT/component/clear.gif" width="3" height="1" alt="" border="0" />

    </td>

    """;

    print_my_components($p);

  }





  """

      <td width="3">

        <img src="$*PALIMGROOT/component/clear.gif" width="3" height="1" alt="" border="0" />

      </td>

    </tr>

  </table>

  """;



  if($k1Swidth != "") {

    """</td></tr></table>""";

  }





  """

  </body>

  </html>

  """;

}





################################################################





###################PROFILE###################################







function print_profile(Page p) {



print_comp_header("Curriculum Vitae");

"""

<table cellspacing="0" cellpadding="0" border="0">

<tr>

<td width="50%" align="center">

</td>

<td align="center"><br /><a href="http://www.livejournal.com/allpics.bml?user=ravenclawdrew"

alt="View my user icons">$p.journal.default_pic</a></td>

<td width="50%" align="center">

</td>

</tr>



<tr>

<td colspan="3" class="compContent">

<div><b>user:</b> <span class="ljuser" style="white-space:nowrap;"><a href="http://www.livejournal.com/users/ravenclawdrew/info"><img

src="http://stat.livejournal.com/img/userinfo.gif" alt="userinfo" width="17" height="17" style="vertical-align:bottom; border:0;" /></a><a href="http://www.livejournal.com/users/ravenclawdrew"><b>ravenclawdrew</

b></a></span></div>

</div>

</td>

</tr>

</table>

""";



print_comp_header("Raventags");



var int tag_count = 0;

var Tag[] my_tags = $p->visible_tag_list();



var Color[]  tag_bg_color;



$tag_bg_color[0] = "#6d7fb3"; # bg color for images (alternates)

$tag_bg_color[1] = "#728d80"; # bg color for images (alternates)



"""

<p></p>



<div style="position:relative; width:100%; height:200px; z-index:1; overflow: auto; overflow-x: hidden;">

<table width=100% cellpadding=3>

""";



foreach var Tag t ($my_tags)

    {

    """

    <tr style="background-color:$tag_bg_color[$tag_count % 2];">

    <td><a rel="tag" href="$t.url">$t.name</a></td></tr>

    """;



    $tag_count++;

    }



"""

</table>

</div>

""";



print_comp_footer();

}



################################################################





###################COMMENT FOOTER###################################



function CommentInfo::print() {

    if ($.enabled) {

        $this->print_postlink();

        if ($.count > 0 or $.screened) {

            """ <img src="http://i3.photobucket.com/albums/y54/ravenclawdrew/remembrallgakmim

isoliel.gif"> """;

            $this->print_readlink();

        }

    }

}



################################################################





###################ENTRY OVERRIDE###################################



function print_entry(Page p, Entry e, Color bgcolor, Color fgcolor, bool

hide_text) {





  if ($p.view=="friends") {

      """<a name="$e.journal.username$e.itemid"></a>""";

  } else { # for recent, day, entry pages.

      """<a name="item$e.itemid"></a>""";

  }

  



print_entry_header((defined $e.security_icon?"$e.security_icon ":"")+ "  <date4>  "+$e.time->date_format("%%day%%,")+

"  <date2>  "+$e.time->date_format("long")+ "  <date3>  "+$e.time->time_format()+"</div>");



  print_system_box_top();

  """<table cellspacing="0" cellpadding="0" border="0" width="100%"><tr>""";



  if ($p.view=="friends" or ($*show_entry_userpic and defined

$e.userpic) or $e.journal.journal_type=="C") {



     """

     <td valign="top" style="padding-right: 8px;">

     <table cellspacing="0" cellpadding="0" border="0" align="center">

       <tr>

         <td><img src="http://www.livejournal.com/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></td>

       </tr>

     """;



     if (defined $e.userpic) { """

       <tr>

         <td><img src="http://www.livejournal.com/palimg/component/clear.gif" width="1" height="2" alt="" border="0" /></td>

         """;



         if ($p.view=="friends") {

            """ <div style="padding-top: 3px; padding-left: 3px;

padding-right: 3px; padding-bottom: 3px; background-color: """; print $bgcolor.as_string; """ ;" align="center">

            <img border="1" src="$e.userpic.url" width="$e.userpic.width" height="$e.userpic.height" alt=""

style="border-color: """; print $fgcolor.as_string; """ ;" />

            </div> """;

         }else{

            """ <td align="center" class="userpic"><img border="1" src="$e.userpic.url" width="$e.userpic.width" height="$e.userpic.height" alt="" /></td> """;

         }

       """

       </tr>

     """; }



     if ($p.view=="friends" or $e.journal.journal_type=="C") { """

       <tr>

         <td><img src="http://www.livejournal.com/palimg/component/clear.gif" width="1" height="2" alt="" border="0" /></td>

         <td align="center" class="ljuser">$e.journal""";

         if ($e.journal.username!=$e.poster.username) {"""

           <div align="center" class="ljuser">$e.poster</div>""";

         } """

         </td>

       </tr>""";

     }

     """

     </table>

     </td>

  """; }



  """<td width="100%" valign="top">""";

  print_content_top();





  if ($e.subject!="") { """

        <div class="entryHeader">$e.subject</div>

        <div class="entryDash"><img src="http://www.livejournal.com/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></div>

      </td>

      <td width="1" class="medLine"><img src="http://stat.livejournal.com/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></td>

    </tr>

    <tr>

      <td width="1" class="medLine"><img src="http://stat.livejournal.com/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></td>

      <td class="entry">

  """; }



  

  """ $e.text """;



  if ($e.metadata{"mood"}!="") {



    """<br/><br/>""";

    """<b> $*text_meta_mood : </b>""";

    if (defined $e.mood_icon) { """ $e.mood_icon """; }

    print $e.metadata{"mood"};

    """<br/>""";

}

  

  if ($e.metadata{"music"}!="") {



    if ($e.metadata{"mood"}=="") { """<br/><br/>"""; }



    """<b> $*text_meta_music : </b>"""; print $e.metadata{"music"};

"""<br/>""";

}



  if ($e.tags) {

    var int tcount = 0;

    """<b> Tags : </b> """;

    foreach var Tag t ($e.tags) {

      """<a rel="tag" href="$t.url">$t.name</a>""";

      $tcount++;

      if ($tcount != size $e.tags) { """, """; }

    }

    if ($e.metadata{"mood"}!="" or $e.metadata{"music"}!="") { """<br/>"""; }

  }

  print_content_bottom();





  """

  <table width="100%">

    <tr>

      <td width="50%" align="left" valign="center">

        <div class="entryComments">

        """;



        if ($e.comments.enabled) {

          $e.comments->print();

        }

        """

        </div>

      </td>

      <td align="center" valign="center">""";

        # Then print a permanent link to the entry.

    

        """

<div class="entryComments"><span style="white-space:nowrap;"><b>( <a href="$e.permalink_url" class="commentLinks">$*text_permalink</a> )<b></span></div>

      </td>

      <td width="50%" align="right" valign="center">""";

      

        """<div class="entryComments">

          """;

  

          $e->print_linkbar();





        """

        </div>

      </td>

    </tr>

  </table>

  """;





  """</tr></td></table>""";

  print_system_box_bottom();

  """ <div><img src="http://www.livejournal.com/palimg/component/clear.gif" width="3" height="3" alt="" border="0"></div> """;



}



function RecentPage::lay_print_summary() {

  print_comp_header("Ravennotes");

"""<div id="Layer1" style="border:0px solid #878787; position:relative; width:100%; height:500px; z-index:1; overflow: auto; overflow-x: hidden;scrollbar-3dlight-color: #4d3215; scrollbar-arrow-color: #ffffff; scrollbar-base-color: #2383CD; scrollbar-darkshadow-color: #084370; scrollbar-face-color: #2383CD; scrollbar-highlight-color: #084370; scrollbar-shadow-color: #2383CD;">

<table width="180px" cellspacing="0" cellpadding="0" valign="top">

<tr valign="top" width="200px">

<td width="200px">

<img src="http://www.livejournal.com/palimg/component/clear.gif" width="100" height="1" alt="" border="0">

</td>

""";





var int size = size $.entries - 1;

   if ($size<0) { return; }



   # loop on the entries

   foreach var int pos (0..$size) {



      # Get the Entry and start the summary line

      var Entry e = $.entries[$pos];



      var string subject = ($e.subject!=""?$e->plain_subject():"<i>(no subject)</i>");

      """<div>""";



      # On the Friends page print: <poster_name> : <journal_name> : <security_icon> <subject> [+<comment_count>]

      if ($.view=="friends") {













         """$e.poster """;

         if ($e.journal.username!=$e.poster.username) { """: $e.journal : """; }

         if (defined $e.security_icon) { """$e.security_icon """; }

         """<a href="#$e.journal.username$e.itemid">$subject</a>""";

         if ($e.comments.count>0) { """ <a href="$e.comments.read_url">[+$e.comments.count]</a>"""; }



      # On the Recent page print: <date> <time> : <security_icon> <subject> [+<comment_count>]

      }else{ # recent page

         print $e.time->date_format()+" "+$e.time->time_format()+" : ";

         if (defined $e.security_icon) { """$e.security_icon """; }

         """<a href="#item$e.itemid">$subject</a>""";

         if ($e.comments.count>0) { """ <a href="$e.comments.read_url">[+$e.comments.count]</a>"""; }



      # Close if..else loop and end the summary line

      }



      """</div>""";



      # If it's not the last summary line, print a seperator bar



      if ($size!=$pos) {

        """

        <div class="medLine"><img src="http://www.livejournal.com/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></div>

        <div class="ltLine"><img src="http://www.livejournal.com/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></div>

        """;

      }



   # End the loop for entries

   }

"""

</tr>

</table>

</div>

""";



print_comp_footer();





}

Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

  • 2 comments