![]() |
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. |
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. |
Where would that eval code go? What file?
|
Wherever you are needing to use the template.
|
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') . '";'); |
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).
|
Quote:
|
Quote:
|
Quote:
I searched all templates for "globaltemplates", nothing found. I went to plug-in manager, clicked add and have this active: https://vborg.vbsupport.ru/external/2009/03/51.png 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. |
$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.
|
All times are GMT. The time now is 10:51 PM. |
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:
|