The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Call a custom template in various places
I have this code
PHP Code:
|
#2
|
|||
|
|||
You would need to use a plugin. In the plugin you'd set up any variables you need, register them to your template, then render the template and save the output in a variable. You'd then register that variable to the postbit template, and then use 'vb:raw' in postbit to put it where you want.
I know that sounds complicated, but it's not really that difficult. There's an article here on how to render a template: https://vborg.vbsupport.ru/showthread.php?t=228078 |
Благодарность от: | ||
MarkFL |
#3
|
|||
|
|||
Quote:
For example, I have a custom template called "targhette" (that contains the code I've posted above) and i want to call it with {vb:raw targhette} in postbit_legacy and memberinfo, how I can do this? I need to create a new plugin with this code? Is this correct? PHP Code:
|
#4
|
|||
|
|||
That's pretty close. I think like this:
Code:
$templater = vB_Template::create('targhette'); $templater->register_page_templates(); $templater->register('my_var', $my_var); $templater->register('my_array', $my_array); $targhette = $templater->render(); vB_Template::preRegister('postbit_legacy', array('targhette' => $targhette)); Edit: oh, I'm assuming that you know that the my_var and my_array register lines are just examples. If you use variables in your custom template, you'd want to replace those two lines with one or more lines to register your variables. |
#5
|
|||
|
|||
Quote:
I'm trying with this plugin: PHP Code:
The template hook i'm using is member_complete. |
#6
|
|||
|
|||
I think you want to change the userinfo register line like this:
PHP Code:
|
#7
|
|||
|
|||
Oh, if you're putting it in a block you probably need a different hook. Maybe try 'member_execute_start' instead.
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|