Announcement

Collapse
No announcement yet.

Shortening Breadcrumbs

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Shortening Breadcrumbs

    With the new style I have been working on I wanted to have the breadcrumbs appear on one line. The problem was the number of links that could be displayed depending on how deep subs forums went.

    Taking a look at the php that generated the breadcrumbs I noticed two varibles that maintained their values as the navbar_link template was evaluated. Using these two varibles I modified the navbar_link template to display no more than the last three elements. For example, lets say you have this: forum home -> sub_forum -> sub_sub_forum -> sub_sub_sub_forum -> mypost. The below modification will only display: sub_sub_forum -> sub_sub_sub_forum -> mypost. The home graphic and reload graphic are still displayed.

    Open navbar_link template. Highlight all the code, and paste this over it:

    Code:
     
    <if condition="$show['breadcrumb']">
     <if condition="$lastelement < 3">
     <strong><a href="$nav_url">$nav_title</a></strong> &gt; 
     <else />
      <if condition="$lastelement - $counter > 1">
       <if condition="$lastelement - $counter == 2">
       <strong><a href="$nav_url">$nav_title</a></strong> &gt; 
       </if>
      <else />
      <strong><a href="$nav_url">$nav_title</a></strong> 
      </if>
     </if>
    <else />
     $nav_title
    </if>
    You will need to modify the navbar template to suit your needs, and replace the home and reload graphics with something more suitable. An example modification to display the breadcrumbs on one line in navbar:

    Open navbar template, find: <if condition="is_array($navbits)">. Highlight that line and continue down to the </if>. Paste this over it:

    Code:
     
      <if condition="is_array($navbits)">
       <table cellpadding="0" cellspacing="0" border="0">
       <tr valign="bottom">
        <td><a href="#" onclick="history.back(1); return false;"><img src="$stylevar[imgdir_misc]/navbits_start.gif" alt="$vbphrase[go_back]" border="0" /></a></td>
        <td>&nbsp;</td>
        <td width="100%">$navbits[breadcrumb]<if condition="$_SERVER['REQUEST_METHOD'] == 'POST'"><img class="inlineimg" src="$stylevar[imgdir_misc]/navbits_finallink_$stylevar[textdirection].gif" alt="" border="0" /><else /><a href="$navbar_reloadurl"><img class="inlineimg" src="$stylevar[imgdir_misc]/navbits_finallink_$stylevar[textdirection].gif" alt="$vbphrase[reload_this_page]" border="0" /></a></if> <strong>$navbits[lastelement]</strong></td>
       </tr>
       </table>
      <else />
       <div class="navbar" style="font-size:10pt"><a href="$vboptions[forumhome].php$session[sessionurl_q]" accesskey="1"><img class="inlineimg" src="$stylevar[imgdir_misc]/navbits_start.gif" alt="" border="0" /></a> <strong>$vboptions[bbtitle]</strong></div>
      </if>
    Hopefully some will find the above useful when creating a new style, or just to unclutter the breadcrumbs area a bit.
    Last edited by DoE; Sat 25th Apr '09, 6:10pm.
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...
X