The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
How to hook in all page of vBulletin 3.84
Hi all,
I am researching to write my plug-in in vB3.x I would like to insert addition information into header of my forum (header template). I wrote a plug-in and used code following to insert: Code:
global $vbulletin; $additionalVar = "Additional Content"; $vbulletin->templatecache['header'] = str_replace('<!-- Additional-Content -->', '<!-- Additional-Content --><br />'.$additionalVar, $vbulletin->templatecache['header']); And in the header template, I putted the text <!-- Additional-Content --> into location that I want to. However, when I accessed to my forum, it changed nothing. But if I tried to use command print $additionalVar to print directly in plug-in, so "Additional Content" string displayed on top of the forum homepage, but when I accessed another page, the text disappeared. So I would like to know: - How to transfer content of variable from plug-in to template. - Which location need to be hooked in order to change for all page of forum. Thanks! |
#2
|
|||
|
|||
I think choosing a different hook will solve both those problems. If you look in global.php and search for "parse headinclude", you can see where the header template is used, so obviously you want to pick a hook location before that (you can also see which hooks are before that by looking for "fetch_hook" in the code).
I think you could prbably use global_start. |
#3
|
|||
|
|||
Thanks kh99,
I did following your instruction and found location need to hook for header template. That is parse_templates However, I have not yet found solution for the first issue. ---------------------------------------------------------------------------------------- I tried to hook into parse_template location, it has an error when I used following command: Code:
$vbulletin->templatecache['header'] = "New Content's Header"; Code:
Parse error: syntax error, unexpected T_LNUMBER in C:\pathtoforum\global.php(833) : eval()'d code on line 3 |
#4
|
|||
|
|||
I created a test plugin using parse_templates and this code:
Code:
$vbulletin->templatecache['header'] = "New Content's Header"; and it works without an error. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|