The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
How-To Cache Templates
This article assumes that you are building your own product with end-user options. INTRODUCTORY ON CACHING TEMPLATES: Whenever you create a product you should cache your templates by adding them to the $globaltemplates and $actiontemplates array. $globaltemplates are templates loaded by all actions. $actiontemplates are templates loaded when a specified action is called such as $do (e.g. ?do=edit). TEMPLATES NOT CACHED: Quote:
To remedy this some coders add the uncached templates to the $globaltemplates array. However, this is the wrong way to do it. As a coder, our obligation is to cache the least amount of templates to consume less memory. *NOTE: This usually happens when you are redirected back to the page via $_POST. THE FIX: To cache these templates, we add the following: PHP Code:
EXAMPLE: A blog product that I am working on will display an error message to the end-user upon an error. The error message will be on the same page (redirected back via $_POST) not a STANDARD_ERROR page. The interface is full of options that at the very least requires the end-user to enter a TITLE and DESCRIPTION. The interface is accessible by the action "do=options". To cache the required templates to build the interface I add the templates to the $actiontemplates array such as: PHP Code:
whenever the end-user forgets to enter a TITLE an error message is displayed. (The system requires the title.) When the error message is displayed none of the templates are cached. We are missing something... To remedy this we need to look at the $_POST "do" action of the form. A closer look at the html source tells me that the "do" action is HTML Code:
<input name="do" value="insertsettings" type="hidden">
PHP Code:
The final code should look like this: PHP Code:
|
#12
|
||||
|
||||
if it's a file add it to $globaltemplates array (found at the top of page):
HTML Code:
$globaltemplates = array( 'other_templates_here', 'adv_portal_photoplog_thumbs', ); |
#13
|
|||
|
|||
Well, the template is called by the file, but I'm not sure exactly where to edit the $globaltemplates array itself.
Apologies for noobing up your thread, I've actually wondered how to do this for awhile now. |
#14
|
||||
|
||||
I don't really know anything about that hack but you can add the template to the cache_templates hook (plugin):
$globaltemplates[] = 'adv_portal_photoplog_thumbs'; I recommend adding some kind of condition to it. Have you tried asking the author of the hack? It could just be something that he overlooked. |
#15
|
|||
|
|||
Yeah, I posted in his thread, I'm just trying to do it myself so that I know how in the future. I didn't even think of just adding it to the hook. Thanks man.
|
#16
|
|||
|
|||
the geek articles use the template cache, i have make a mistake in my modification but i can edit it :s where can i delete this template cache ?
|
#17
|
||||
|
||||
I'm not sure what you mean. Have you asked the author of the hack?
|
#18
|
|||
|
|||
princeton This article good for creating stand-alone pages, but I need wrote plugins, wich evalulate templates without modify standart forum code.
How ? PHP Code:
|
#19
|
||||
|
||||
netwind,
follow the instructions found on this page: https://vborg.vbsupport.ru/showthread.php?t=99132 |
#20
|
||||
|
||||
ok trying to follow this rule but still confused which i'm learning to cache this template because i have this on my forum
Code:
Uncached templates: Marquee_Text (1) PHP Code:
|
#21
|
||||
|
||||
add the template to the cache_templates hook (plugin):
Code:
$globaltemplates[] = 'Marquee_Text'; |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|