View Full Version : Taking the Breadcrumb out of the the Navbar
ArgylePhoto
11-23-2008, 07:13 AM
Hi,
I want to have my breadcrumb in a separate template to my navbar. I've created the template and plugins (one at hook location cache_templates and one at hook location parse_templates) to make it show but the breadcrumb doesn't work, it only ever shows the forum name. From what I can tell the conditional "<if condition="is_array($navbits)">" in the breadcrumb template isn't being satisfied. How can I fix that? I tried searching but I can't find an answer. I want to use this template on all the pages that the breadcrumb would be shown on normally.
Thanks in advance. :)
Lynne
11-23-2008, 05:02 PM
You need to make sure the template you are using is evaled after $navbits is defined. So, you may have to pick a different hook location than parse_templates to eval your template.
ArgylePhoto
11-23-2008, 05:52 PM
Have you any idea what location? Navbits_complete seems the obviuos choice but doesn't seem to work. I'm not really sure where the hook locations are exactly
--------------- Added 1227471136 at 1227471136 ---------------
Incidentally I'm using
eval('$breadcrumb = "' . fetch_template('breadcrumb') . '";');
to evaluate the tenplate. Is that right or should I change it?
Lynne
11-23-2008, 06:44 PM
I've never played with this, so I can't give a define solution. Your eval looks correct, but why aren't you just putting in $navbits where you want instead of evaling a template and putting in $breadcrumb?
ArgylePhoto
11-23-2008, 07:09 PM
I'm not sure what you mean? If I put $navbits in a template it just prints the word 'array'. My $breadcrumb template looks like
<table align="center" bgcolor="#ccccff" width="840px" cellpadding="25px" cellspacing="0"><tr><td bgcolor="#ffffff" width="100%" valign="top" height="60px">
<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> </td>
<td width="100%"><span class="navbar"><a href="$vboptions[forumhome].php$session[sessionurl_q]" accesskey="1">$vboptions[bbtitle]</a></span> $navbits[breadcrumb]</td>
</tr>
<tr>
<td class="navbar" style="font-size:10pt; padding-top:1px" colspan="3"><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>
</td>
</tr>
</table>
dunno if that matters. It's always used below the navbar template with another custom template between them.
Lynne
11-23-2008, 08:02 PM
I'm just thinking that you are evaling it at the wrong time and I'm not sure what to suggest regarding that. For instance, I happen to have member.php opened and the $navbar array isn't contructed until the very bottom of that page. Therefore, if you pick any hook location that gets evaled *before* that point, you aren't going to get it evaled correctly. The only hook location after that is member_complete. But, that isn't available on every page. So, I'm not sure how you are supposed to go about this without having several plugins that eval your template all for different pages.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.