vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=187)
-   -   Manage Templates (https://vborg.vbsupport.ru/showthread.php?t=99132)

Oblivion Knight 10-22-2005 10:00 PM

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'));
Replace [high]xxxx[/high] 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 [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'));
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:
Code:

$only['xxxx'] = 'Group Name';
Replace [high]xxxx[/high] 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:
Code:

$only['xxxx'] = $vbphrase['yyyy'];
Replace [high]yyyy[/high] with the phrase variable.

Snake 10-28-2005 02:07 PM

Oh man thank you very much! I was on my way to request this as a tutorial. :mad:

Andreas 10-28-2005 02:16 PM

If you are going to cache only one Template,

PHP Code:

$globaltemplates[] = 'xxxx'

might be better than array_merge().

Oblivion Knight 10-28-2005 02:31 PM

True, but using the array_merge() function allows additional templates to be added more easily.

dutchbb 11-10-2005 04:41 PM

How do I put 'include' and 'eval' for additional templates in a hook please?
Ty

SaN-DeeP 05-06-2006 04:43 AM

thanks for
Quote:

Grouping Custom Templates in the Admin CP

T2DMan 05-11-2006 01:50 PM

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') . '";');

Chadi 02-26-2007 01:13 AM

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?

pritesh_shah83 09-24-2008 10:12 PM

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

Dismounted 09-25-2008 03:08 AM

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
  • Page Generation 0.01220 seconds
  • Memory Usage 1,736KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete