The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
[How to] include a code within templates using a plugin or from another template
Hi,
I know now how to create a plugin and link it to a hook, and how to create a template and put it "manually" on an existing template, but what I don't know yet is how to put a piece of code from a plugin or from a template "created manually" on a specific place within an existing template such as the posbit, posbit_legacy, showthread and so on. I need to do it to create a general product, right? Well, I tried using hooks, but sometimes they do not help, they do not cover some places within some templates. Any help will be highly appreciated. |
#2
|
|||
|
|||
I was hoping someone else could answer who might be able to explain better, but...
You need to do a str_replace() (or equivalent) on $vbulletin->templatecache['template_name'], and it has to be at a hook location where the templates have been cached but not rendered yet. Location parse_templates should work. Also, you need to look at the compiled template to see what you can match as the "needle" in str_replace(). It may or may not be the same as you see when you look at the template in the template editor. To see the compiled template, look in the "template" table of the database in the "template" column, or print out the value of $vbulletin->templatecache['template_name']. So when you've done all that your code could look something like: PHP Code:
Note that most compiled templates are actually php code that produces the template html when eval'd, so you could also insert php code into the template is you wanted. |
#3
|
|||
|
|||
Great! that what I was looking for, thanks.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|