The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Injecting code into existing template code
I'm not sure how to do this. I'm not sure if I need to use hooks or if I can do a str_replace (is that even good practice with vB4?).
Basically, I want to write a plugin that injects an image in the header, after the "Welcome, user" text. The easy thing would be to just modify the template, but I want to avoid modifying any of the core templates. header template PHP Code:
|
#2
|
|||
|
|||
The only way to do it without modifying the template (or doing something a lot more complicated) would be to do a str_replace at some point, either before or after it's rendered. But it can be difficult to figure out exactly what string to match.
Looking at the compiled header template from the database (which is what will be in the template cache), the part you want looks like this: Code:
vB_Template_Runtime::linkBuild("member", $bbuserinfo) . '') . '</li> and you'd want to insert your code just before the </li> at the end. So maybe something like this (maybe at hook parse_templates): PHP Code:
You may also be interested in this mod: www.vbulletin.org/forum/showthread.php?t=152931 although I haven't tried it myself. |
#3
|
|||
|
|||
Very helpful. Thank you.
And yes, that mod will most definitely help out. Thanks for the link! |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|