View Full Version : Add text to breadcrumb line
PaulProe
02-15-2016, 01:04 AM
I would like to add the text "You are at: " at the beginning of the breadcrumb line. I am a newbie to vBulletin and PHP and learning as I go.
I determined the template to modify is the navbar.php template. I find the breadcrumb section but don't know how to format the code properly to have it display as one common line. I tried various lines and can get the words to display, but not in line with the current location. I've tried {vb: phrase and {vb:rawphrase but can't come up with something that works. This is the line of code from the template:
<div id="breadcrumb" class="breadcrumb">
<div class="main_wrap">
<ul class="floatcontainer">
{vb:raw navbits.breadcrumb}
{vb:raw navbits.lastelement}
</ul>
</div>
</div>
Can someone help me with the proper code to make the breadcrumb read:
You are at: Forum/Category1/Threadname
Thanks
Paul
Skyrider
02-15-2016, 06:45 AM
The simple way:
At navbar:
Find:
<div class="body_wrapper">
<div id="breadcrumb" class="breadcrumb"<vb:if condition="THIS_SCRIPT == 'index'"> style="display:none;"</vb:if>>
<ul class="floatcontainer">
<li class="navbithome">You are at: <a href="index.php{vb:raw session.sessionurl_q}" accesskey="1"><img src="{vb:stylevar imgdir_misc}/navbit-home.png" alt="{vb:rawphrase home}" /></a></li>
{vb:raw navbits.breadcrumb}
{vb:raw navbits.lastelement}
</ul>
Which can be found below:
<!-- closing div for above_body -->
You can add: "You are at:" at this line:
<li class="navbithome">You are at: <a href="index.php{vb:raw session.sessionurl_q}" accesskey="1"><img src="{vb:stylevar imgdir_misc}/navbit-home.png" alt="{vb:rawphrase home}" /></a></li>
And it works for me :). Home icon is in the way though if that doesn't bother you. But it can be easily removed by removing the code.
<img src="{vb:stylevar imgdir_misc}/navbit-home.png" alt="{vb:rawphrase home}" />
More official way:
Now, if you want something more "official".. Go to: AdminCP -> Languages & Phrases -> Phrase Manager -> Add new Phrase
Leave the type and product as it is, and as for the "Varname", use something that is related to what you want. For example, for the sake of it lets use "you_are_at" (with the _) and in the Text box, type in You are at:. So, you'll be having this:
Phrase Type: GLOBAL
Product: vBulletin
Varname: you_are_at
Text: You are at:
You can ignore the translation box if you don't use any translation files other than English. Now, go back to the navbar template and replace:
<li class="navbithome">You are at: <a href="index.php{vb:raw session.sessionurl_q}" accesskey="1"><img src="{vb:stylevar imgdir_misc}/navbit-home.png" alt="{vb:rawphrase home}" /></a></li>
With
<li class="navbithome">{vb:rawphrase you_are_at} <a href="index.php{vb:raw session.sessionurl_q}" accesskey="1"><img src="{vb:stylevar imgdir_misc}/navbit-home.png" alt="{vb:rawphrase home}" /></a></li>
And you are done :).
MarkFL
02-15-2016, 02:06 PM
An alternate that won't require you to edit any templates, and will work in all of your styles would be to create the following plugin:
Product: vBulletin
Hook Location: parse_templates
Title: Add Text Before Breadcrumb
Execution Order: 5
PHP Plugin Code:
$vbulletin->templatecache['navbar'] = str_replace('<li class="navbithome">', '<li class="navbithome"><span>You are at: </span>', $vbulletin->templatecache['navbar']);
Plugin is Active: Yes
Click "Save".
PaulProe
02-15-2016, 05:23 PM
Thanks, everyone - worked perfectly.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.