![]() |
Make custom templates and call it with "vb:raw"
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? |
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'); |
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! |
Quote:
Quote:
|
May i ask what the last row mean?
vB_Template::preRegister('header', array('custom_header_mysite_beta' => $customheader)); What is that $customheader and what if i change it to something else? |
Quote:
Quote:
|
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! |
Quote:
You can also use one preRegister call (assuming they're all going to the header template), like: Code:
$template = vB_Template::create('template1'); 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. |
So you say i can do something like this in the same plugin right?
Code:
$template = vB_Template::create('custom_header_mysite_beta1'); should i call in this way: {vb:raw template1} {vb:raw template2} {vb:raw template3} ? Thanks alot for you kind help!! |
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. |
All times are GMT. The time now is 01:40 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|