unique.wonders. (ex_uniquewo) wrote in component_help,
unique.wonders.
ex_uniquewo
component_help

  • Mood:

Additional Links in Sidebar Navigation Component

Quick and dirty version because I don't have kunzite1's level of gloriousness :P


###################################################
#
#  ADDING LINKS TO THE NAVIGATION COMPONENT
# uniquewonders, component-help/884462 
# overrides function print_nav_comp (Page p)
#
#################################################


function print_nav_comp (Page p) {
    var string title = $p->title();
	var string website = "";
	if($p.journal.website_url) {
        var string website_name = $p.journal.website_name ? $p.journal.website_name : $*text_website_default_name;  		
	$website = "<div class=\"compList\"><a href=\"" + $p.journal.website_url + "\" class=\"headerLinks\">" + $website_name + "</a></div>\n";
	}

    var string[] views_order = ["recent", "friends", "archive", "userinfo"]; # view order
                                                                             # "recent"   = recent   view
                                                                             # "friends"  = friends  view
                                                                             # "archive"  = calendar view
                                                                             # "userinfo" = userinfo link
    var string{} view_text   = { # build text hash
                                "recent"   => $*nav_entries_text,
                                "friends"  => $p.journal_type != "C" ? $*nav_friends_text : $*text_view_friends_comm,
                                "archive"  => $*nav_calendar_text,
                                "userinfo" => $*nav_info_text
                               };
    var string   base_url    = $p.journal->base_url(); # get base url
    var string{} view_url    = { # build url hash
                                "recent"   => "$base_url/",
                                "friends"  => "$base_url/friends/",
                                "archive"  => "$base_url/calendar/",
                                "userinfo" => "$*SITEROOT/userinfo.bml?user=$p.journal.username&mode=full"
                               };

"""
  <tr>
     <td colspan="7">
	<table cellspacing="0" cellpadding="0" border="0" width="100%">
	   <tr>
		<td valign="top" rowspan="3" colspan="3" width="5"><img src="$*ctl" width="5" height="5" alt="" border="0" /></td>
		<td class="dkLine"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
		<td valign="top" rowspan="3" colspan="3" width="5"><img src="$*ctr" width="5" height="5" alt="" border="0" /></td>
	   </tr>
	   <tr>
		<td class="ltLine"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
	   </tr>
	   <tr>
		<td class="tabBg"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td>
	   </tr>
           <tr>
		<td class="dkLine" width="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
		<td class="ltLine" width="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
		<td class="tabBg" width="3"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td>
		<td class="tabBg" width="100%">

                <!-- HEADER CONTENT -->""";

                foreach var string v ($views_order) {
                     print """<div class="compList"><a href="$view_url{$v}" class="headerLinks">$view_text{$v}</a></div><div class="ltLine"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></div>""";
                }

               # use these templates to add your own links (code in pink)
               # delete the # in front of the line, change the URL and link's name
	       # if you don't have a website listed in your user info delete
               # <div class="ltLine"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></div>
	       # in the line of code for your last link. Otherwise you'll have a double line.

                   # print """<div class="compList"><a href="$*SITEROOT/tools/memories.bml?user=$p.journal.username" class="headerLinks">memories</a></div><div class="ltLine"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></div>""";
                   # print """<div class="compList"><a href="http://www.yahoo.com/" class="headerLinks">yahoo!</a></div><div class="ltLine"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></div>""";
		
                  """$website""";
		  $p->lay_viewspec_nav();

	        """</td>
	        <td class="tabBg" width="3"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td>
	        <td class="ltLine" width="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
	        <td class="dkLine" width="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
	   </tr>
           <tr>
		<td valign="top" rowspan="3" colspan="3" width="5"><img src="$*cbl" width="5" height="5" alt="" border="0" /></td>
		<td class="tabBg"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td>
		<td valign="top" rowspan="3" colspan="3" width="5"><img src="$*cbr" width="5" height="5" alt="" border="0" /></td>
	   </tr>
           <tr>
		<td class="ltLine"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
	   </tr>
	   <tr>
		<td class="dkLine"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
	   </tr>
	</table>
      </td>
  </tr>		
  <tr>
     <td><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td>
  </tr>
""";
}


Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic
  • 5 comments