The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Need to add a menu to the subnav with a plugin
I'm looking to add a dropdown at the beginning of the subnav in the forum and CMS.
Probably the blog too. I have the html. For the navbar I need to enter it in two places, one for those registered and one for guests. It will be the first item in the bar. Same in the CMS and blog. I can hard code it all with no problem, but need to remember if I make a change in 1 place, I need to change it in 3 or places. In vB3 I created a plugin that stored a variable. The variable $mymenu in this case would be the html. Then I'd hardcode $mymenu where I needed it and edit the plugin when necessary. Another way I used to edit templates was find and replace. I don't understand how to do it in vB4. I've read a couple articles on how to use the new variables. I just don't understand it. Perhaps I can make a plugin that stores the html as in vB3?, I still don't understand how to use that variable in a template. Any advice? |
#2
|
||||
|
||||
You can probably write the plugin and have the contents in a variable, $mymenu, just like before and then preregister the variable for use in the navbar. That should be no problem. I think the blog and cms also use templates for the link, so you'd have to preregister it for them also. Then you'd have to edit the templates to add the variable.
PHP Code:
|
#3
|
||||
|
||||
I'm thinking then my plugin would need to be
Hook: process_templates_complete PHP Code:
|
#4
|
||||
|
||||
You don't use $mymenu anymore - you need to use the new syntax. The new syntax is {vb:raw mymenu} . Check the functions.php page where the navbar is rendered and make sure your hook is located *before* that.
|
#5
|
||||
|
||||
Quote:
You would think the hook should be navbits_complete, if I am reading this correctly. PHP Code:
|
#6
|
||||
|
||||
No, you aren't reading that correctly. That is a function. It gets called from somewhere and that is where you would look backwards from.
|
#7
|
||||
|
||||
Looking at your tab, I realize that I had this reversed. It should be
PHP Code:
But thanks! I'm on my way. |
#8
|
||||
|
||||
If it works, great! I could be that the hook is called right before the function is called (but it isn't obvious in the code you posted).
|
#9
|
||||
|
||||
Now I'm trying to use the same plugin in the CMS subnav.
Am I able to preRegister twice within the same plugin? I changed the variable to chapterprograms. PHP Code:
|
#10
|
||||
|
||||
Sure, you can preregister a variable for a couple of templates in one plugin. You just need to make sure it is the proper plugin to use for each of those templates.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|