![]() |
|
Article Options |
Manage Templates
by
![]() 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:
Replace xxxx with the template that you are wanting to cache. It's as simple as that! Also, if you're wanting to cache multiple templates, simply add a comma after the last ' and wrap a second template name with 's. You should have something like this:
Repeat as required.. ![]() Grouping Custom Templates in the Admin CP Add a plugin to the following location: vBulletin : General Administration -> template_groups With the following code:
Replace xxxx with the template prefix that you are wanting to group. 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:
Replace yyyy with the phrase variable. The following members like this post: TTayfun
|
||||||||||||||||
Views: 11252
|
Comments |
#2
|
||||
|
||||
Oh man thank you very much! I was on my way to request this as a tutorial.
![]() No members have liked this post.
|
#3
|
||||
|
||||
If you are going to cache only one Template,
might be better than array_merge(). No members have liked this post.
|
#4
|
||||
|
||||
True, but using the array_merge() function allows additional templates to be added more easily.
No members have liked this post.
|
#5
|
|||
|
|||
How do I put 'include' and 'eval' for additional templates in a hook please?
Ty No members have liked this post.
|
#6
|
||||
|
||||
thanks for
__________________
TechArena TechArena Community Forums Telegram - Last hope for social media engagement for vbulletin No members have liked this post.
|
#7
|
|||
|
|||
Cache, then need to use the template
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') . '";');
__________________
Michael Brandon Webmaster and owner of RenewedReflections Weight Loss Surgery Forum No members have liked this post.
|
#8
|
||||
|
||||
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?
__________________
............................... Talk Jesus Forums: Christian Chat games . chat . gallery . bible . videos No members have liked this post.
Last edited by Chadi; 26 Feb 2007 at 03:24. Reason: Automerged Doublepost |
#9
|
|||
|
|||
Grouping custom templates does not work for me
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 No members have liked this post.
|
#10
|
||||
|
||||
Do you actually have a template prefixed with that prefix?
__________________
Former vBulletin.org Staff Member View My Modifications 29 Releases and Counting... Latest Modification: dmActivityStream - vBookie Integration (4.x) Please do not PM me to ask for support - please use the relevant thread or forum. No members have liked this post.
|
#11
|
|||
|
|||
The templates that I wish to group start with NewTemplategroup. And this is what I found:
Use newtemplategroup in lower-case as the array index, otherwise it doesn't work ![]() // This works like a charm ![]() $only['newtemplategroup'] = 'New Template group'; // This does not work ![]() $only['NewTemplategroup'] = 'New Template group'; Thanks for the quick reply. I hope this helps someone ![]() No members have liked this post.
|
#12
|
|||
|
|||
Group Custom Templates the Easy Way
[quote=Oblivion Knight;803104]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..
Now in plain english the easiest way to do this step by step is: Add a plugin to the following hook location: Plugins & Products: Add New Plugin step 1 example:
step 2 example: Languages & Phrases: => Phrase Manager => Add New Phrase
last step example: Styles & Templates => choose your current style unless you have debug mode on, you can chooseMASTER STYLE => Add New Template
I still give credits to Oblivion Knight, however, this I would rather say because it is far more easier to do these step by step. Now that I have gave you a break down on how to accomplish this the easy way, please feel free to rep me. But please, this original tutorial was by Oblivion Knight, I just broke it down in PLAIN ENGLISH! Thanks! ![]() No members have liked this post.
|
#13
|
||||||||
|
||||||||
For some reason when I did this with a prefix with an underscore (_) it did not work, but as soon as I took the underscore out it worked just fine.
From the examples above it would appear that some people have gotten it to work with an underscore in their prefix, but it's just not working for me in 3.8. But the thing is, all of my vBa scripts have underscores in their template groups (adv_portal, adv_links), so I know it should work. Any ideas?
Works
Does NOT work
__________________
Just a placeholder. ![]() No members have liked this post.
|
#14
|
||||
|
||||
hello vB experts
i need some help i tried to add template into ad location section (template) and i did exactly the tutor said temlate group
then i created the template within prefix ad_ but seem not work the template i created it till outside of the ad location group any suggestion will be appriciated Sincerely, No members have liked this post.
|
#15
|
||||||||
|
||||||||
Originally Posted by Davidinh
Don't include the underscore. Just the prefix name:![]()
Not tested, but should work.
__________________
No members have liked this post.
|
![]() |
«
Previous Article
|
Next Article
»
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Article Options | |
|
|
New To Site? | Need Help? |
All times are GMT. The time now is 08:28.