The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
I'm trying to accomplish having totally different navbars for different sections of the site. I.e different dimensions, placement, links, etc.
I've tried copying the current navbar template to an external php file and then using a plugin to include that file into various templates. That works fine, but some of the functions built into the navbar template stop working such as things like $vbphrase and $vboptions. I saw in the docs that making calls to default vbulletin variables from an includes might not work, so maybe that is the problem. Some of the phrases are easy enough to just replace with text and remove the variable, but I'm not keen on re-writing the navbits structure. I also don't think having two different styles will work because I'm not using different navs on different forums, but rather different sections such as user profiles, groups, etc. Too keep this simple, if I just copy the current navbar template into an external file, load that up to the site, create a plugin for the includes and then insert the variable for that includes, i.e. $includeCustomNav into a template such as albumList as a replacement for the default $navbar, what would I need to do to make that work? What am I missing?? Thanks for any help! Doob |
#2
|
|||
|
|||
![]()
Did you try putting something like
Code:
global $vbphrase, $vboptions; in your code? Do you know if $vbphrase is completely undefined, or just doesn't contain the phrases you want to use? Also, some things might depends on which hook location you're using. |
#3
|
|||
|
|||
![]()
I think this puts me on the right track, but I need some more help with the syntax. I think you are suggesting that I need to specifically tell vbulletin to load the global variables found in the new navbar code.
I inserted this into my code but it doesn't work. I suspect I'm missing some bit of syntax. global $vbphrase, $stylevar, $navbits, $foruminfo, $ad_location; Also, the plugin for the includes is at the global_start hook location. Any help on getting this to work will be great since I think I'll need to use this approach quite a bit in the future... |
#4
|
|||
|
|||
![]() Quote:
There's code in different places that makes the navbar work, so I figure that you're missing some of that in your external file. What does the file do exactly? |
#5
|
|||
|
|||
![]()
My goal is to have multiple navbar layouts and then depending on the section of the site use different layouts. I know I can achieve this other ways, but I think for my purposes having the navbar as an external file and then using an includes is the best way to go.
My steps for testing: 1) copy default navbar template 2) create a new file called newNav.php and paste contents from step 1 3) create plugin for includes at global_start with var name $newNav 4) open a template such as album_pictureview and replace $navbar with $newNav Now go to site and view an individual picture (because we're talking about album_picture view) and it will have the new navbar (which looks just like the original navbar) except that any of the global vbulletin variables aren't working. I tried putting this in the newNav.php document, but it doesn't seem to do a thing. <?php global ($vbphrase, $stylevar, $navbits, $foruminfo, $ad_location); ?> |
#6
|
|||
|
|||
![]()
You don't need the parens, what you had before was OK. But it doesn't do any good to declare a variable as global if it's not defined. I suspect your problem is that those variables haven't been set to any value yet when the global_start hook code is run. You would need to figure out where those variables get set and either find a different hook or set them yourself.
|
#7
|
|||
|
|||
![]()
Is there any way to figure out what hook a default template is on? In this case the navbar template.
|
#8
|
|||
|
|||
![]() Quote:
It might be possible for you to include extra navbar templates by creating a plugin at cache_templates and adding your custom templates to the $globaltemplates array, then replace the navbar template in the template cache at the global_start hook. Something like: cache_templates: Code:
$globaltemplates = array_merge($globaltemplates, array('custom_navbar_1', 'custom_navbar_2')); global_start: Code:
if (THIS_SCRIPT == 'showthread') { $vbulletin->templatecache['navbar'] = $vbulletin->templatecache['custom_navbar_1']; } else if (THIS_SCRIPT == 'forumdisplay') { $vbulletin->templatecache['navbar'] = $vbulletin->templatecache['custom_navbar_2']; } I haven't actually tried the above so it's a bit of a guess. BTW, I see you started a couple other threads with these questions, which is fine - I'll leave those to someone else who might be able to give you a better answer. |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|