The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Loading templates within plugins
Greetings,
so i have been testing around for a while but i can't seem to get it to work. I want to load a template into a variable within a plugin. I know how to access plugin-variables within templates but i can't find anything about how to load the template contents within a plugin. Is that even possible? |
#2
|
|||
|
|||
There and article here on rendering templates: https://vborg.vbsupport.ru/showthread.php?t=228078 , I think that explains what you need.
|
#3
|
|||
|
|||
Yes, i found that one too but it doesn't seem to work.
Here is the thing, lets say i got a template named "my_template" and i want to load it within the plugin. According to that article i would write into my plugincode: Code:
$templater = vB_Template::create('my_template'); $rendered = $templater->render(); What i get with that plugin activated is some missing things in my header, but no PHP error! I didn't even use the plugin any further, only those 2 lines of code activated screw someting up in the board. |
#4
|
|||
|
|||
Which hook are you using?
|
#5
|
|||
|
|||
global_bootstrap_init_complete
I just changed to global_bootstrap_complete and it may just work...i think it does... Edit: Nope...i mean ok it does obviously work now somehow, the template gets stored into the variable, BUT with that hook, i can not use it in the header anymore. With the other hook that worked fine. I don't know which hook i should use, so that both works. Just some hook that is always there that i can use for that. |
#6
|
|||
|
|||
Try parse_templates - it's called just before the header template is rendered.
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|