Manage Templates
Want to cache templates or group custom templates in the Admin CP without editing the source code? Of course you do! Want to know how to achieve this? Read on..
Caching Templates This is probably NOT the best way of achieving this, however if you're wanting to effectively cache a template in an existing file (for example, the v3arcade award bits in showthread.php), this how to achieve this with a simple plugin. Add a plugin to the following hook location: vBulletin : General -> cache_templates With the following code: Code:
$globaltemplates = array_merge($globaltemplates, array('xxxx')); It's as simple as that! Also, if you're wanting to cache multiple templates, simply add a comma after the last [high]'[/high] and wrap a second template name with [high]'[/high]s. You should have something like this: Code:
$globaltemplates = array_merge($globaltemplates, array('xxxx', 'yyyy')); Grouping Custom Templates in the Admin CP Add a plugin to the following location: vBulletin : General Administration -> template_groups With the following code: Code:
$only['xxxx'] = 'Group Name'; Once again, this is very easy to do. If you're wanting to do add multiple groups, add a second line below this one and do the same again. If you wish to use a phrase, use: Code:
$only['xxxx'] = $vbphrase['yyyy']; |
Oh man thank you very much! I was on my way to request this as a tutorial. :mad:
|
If you are going to cache only one Template,
PHP Code:
|
True, but using the array_merge() function allows additional templates to be added more easily.
|
How do I put 'include' and 'eval' for additional templates in a hook please?
Ty |
thanks for
Quote:
|
To use a template, you need to make available the variable for that template, before it is used in another template - ie a new $adsense template used in navbar template.
first cache the template as described: cache_template $globaltemplates[] = 'adsense'; Then add it to a variable for use: global_start eval('$adsense = "' . fetch_template('adsense') . '";'); |
Thank you. It worked partially for some reason.
Plugin: $only['quiz'] = 'Quiz'; $only['Display'] = 'Flashchat'; $only['Top_Posters'] = 'Top Posters'; $only['top_statistics'] = 'Top Statistics'; $only['vbfavorites'] = 'vBFavorites'; $only['zointstags'] = 'Zoints Tags'; $only['tutorial'] = 'Tutorial'; The ones that did not get picked up are: $only['Display'] = 'Flashchat'; $only['Top_Posters'] = 'Top Posters'; The prefix are correct for sure. Edit: prefix must be lowercase. One more thing, how do I have the groups listed in alphabetical order? |
I tried
$only['somegroup'] = 'Some Group'; I printed $only and it shows $only['somegroup'] => 'Some Group' But, there is no group called Some Group in my Style Manager. Can you please help |
Do you actually have a template prefixed with that prefix?
|
All times are GMT. The time now is 01:07 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|