The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Custom Template?
I'd like to create a new custom template like I have done in the past. I usually name them like this:
custom_SomeName I'd like to add some small html content (div/tables) into that custom template and be able to pull that template into another template like this: $customtemplatename I tried this but it did not work at all. Would appreciate help on this. |
#2
|
||||
|
||||
You need to eval the template like this in order to then use the contents as a variable:
eval('$customtemplatename .= "' . fetch_template('custom_SomeName') . '";'); Now, you may use $customtemplatename in a template that you eval after that one in the file. |
#3
|
||||
|
||||
Where would that eval code go? What file?
|
#4
|
||||
|
||||
Wherever you are needing to use the template.
|
#5
|
||||
|
||||
I don't understand sorry.
For example: I have some basic html code (for a css menu) in a custom template called "cssmenu" let's say. Then, I want to use $cssmenu in navbar and footer for example. I have to place the below code in those two templates? Code:
eval('$cssmenu .= "' . fetch_template('cssmenu') . '";'); |
#6
|
||||
|
||||
No, php cannot go in into a template. You need to paste that php code into a php file or into a plugin that is called *before* the templates you want to use it in. So, in this case, you need to put that code either directly into a php file, or use a plugin that is evaled before the navbar and footer get evaled (one of the global hook locations?). I think you may also need to add that template to the $globalarray template (another plugin or code edit needed).
|
#7
|
||||
|
||||
$globaltemplates Add your template to that array so it gets cached before use.
|
#8
|
||||
|
||||
*I* knew what I meant! (It's a good thing you come around after my evening posts!)
|
#9
|
||||
|
||||
Quote:
I searched all templates for "globaltemplates", nothing found. I went to plug-in manager, clicked add and have this active: I did nothing else, aside adding my basic html content inside a custom template called custom_Media. I'm not sure what to do from here now. I'm not even sure the above plugin is correct. |
#10
|
||||
|
||||
$globaltemplates is not a template - it's a variable. This may help you to see how things work regarding the use of a template in code - [How-To] vBulletin API Basics: Creating Custom Pages & Misc. Notice the template has to be included in the $globabltemplates array at the top, the code gets done, then the template gets evaled. It *must* be in that order.
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|