The Arcive of vBulletin Modifications Site. |
|
|
#1
|
|||
|
|||
|
Hello all,
Im trying to make some custom template for example i have created template name: custom_header_mysite_beta and i would like to use the content in this code in aother template, for example at header template in the next way: {vb:raw ad_location.global_header1} In my case: {vb:raw custom_header_mysite_beta} How can i do that? |
|
#2
|
|||
|
|||
|
You need to create a plugin, render your template, and preRegister the result to the header template. Hook location parse_templates is a good one to use, and the code could be like:
Code:
$template = vB_Template::create('custom_header_mysite_beta');
$customheader = $template->render();
vB_Template::preRegister('header', array('custom_header_mysite_beta' => $customheader));
|
|
#3
|
|||
|
|||
|
I just take it exactly like it is and paste it in a new plugin?
How should i name the plugin? Once i have done it template will be created and i will be able to use this code: {vb:raw custom_header_mysite_beta} in the header? Thanks alot! |
|
#4
|
|||
|
|||
|
Quote:
.Quote:
|
|
#5
|
|||
|
|||
|
May i ask what the last row mean?
vB_Template: reRegister('header', array('custom_header_mysite_beta' => $customheader));What is that $customheader and what if i change it to something else? |
|
#6
|
|||
|
|||
|
Quote:
Quote:
|
|
#7
|
|||
|
|||
|
Works great!
Do i have limit of how much plugins like that i can create? Or in other words will it slow my website if i will create up to 20 custom plugins like this? Thanks alot for your time and your help! |
|
#8
|
|||
|
|||
|
Quote:
You can also use one preRegister call (assuming they're all going to the header template), like: Code:
$template = vB_Template::create('template1');
$templatevalues['template1'] = $template->render();
$template = vB_Template::create('template2');
$templatevalues['template2'] = $template->render();
$template = vB_Template::create('template3');
$templatevalues['template3'] = $template->render();
vB_Template::preRegister('header', $templatevalues);
But if you'd rather make them separate, I don't think there's a lot of overhead involved in multiple plugins or preRegister calls. |
|
#9
|
|||
|
|||
|
So you say i can do something like this in the same plugin right?
Code:
$template = vB_Template::create('custom_header_mysite_beta1');
$customheader1 = $template->render();
vB_Template::preRegister('header', array('custom_header_mysite_beta1' => $customheader1));
$template = vB_Template::create('custom_header_mysite_beta2');
$customheader2 = $template->render();
vB_Template::preRegister('footer', array('custom_header_mysite_beta2' => $customheader2));
$template = vB_Template::create('custom_header_mysite_beta3');
$customheader3 = $template->render();
vB_Template::preRegister('headerinclude', array('custom_header_mysite_beta3' => $customheader3));
should i call in this way: {vb:raw template1} {vb:raw template2} {vb:raw template3} ? Thanks alot for you kind help!! |
|
#10
|
|||
|
|||
|
Quote:
Quote:
Yes, if you were to use the example code I posted above. The array key is what you use in the vb:raw tag. |
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|