Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 02-15-2016, 01:04 AM
PaulProe PaulProe is offline
 
Join Date: Feb 2015
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Add text to breadcrumb line

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:
Code:
<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
Reply With Quote
  #2  
Old 02-15-2016, 06:45 AM
Skyrider Skyrider is offline
 
Join Date: Feb 2006
Location: Netherlands
Posts: 1,392
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The simple way:

At navbar:

Find:
Code:
<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:
Code:
<!-- closing div for above_body -->
You can add: "You are at:" at this line:
Code:
<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.
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:
Code:
<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
Code:
<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 .
Reply With Quote
3 благодарности(ей) от:
Lynne, MarkFL, TheLastSuperman
  #3  
Old 02-15-2016, 02:06 PM
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Location: St. Augustine, FL
Posts: 3,853
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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:

PHP 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".
Reply With Quote
3 благодарности(ей) от:
Lynne, Skyrider, TheLastSuperman
  #4  
Old 02-15-2016, 05:23 PM
PaulProe PaulProe is offline
 
Join Date: Feb 2015
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks, everyone - worked perfectly.
Reply With Quote
2 благодарности(ей) от:
MarkFL, TheLastSuperman
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:24 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04221 seconds
  • Memory Usage 2,208KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (7)bbcode_code
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (8)post_thanks_box_bit
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit
  • (4)post_thanks_postbit_info
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete