vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=187)
-   -   How to Cache an Uncached Template (https://vborg.vbsupport.ru/showthread.php?t=81545)

dsboyce8624 05-15-2005 10:00 PM

How to Cache an Uncached Template
 
I am posting this because it took me so long to find the answer. It may be elementary to those of you who have been doing this for a while, but not to me.

Anyway, here goes:

Open /forum_root/global.php

Find:

PHP Code:

//misc useful 

At the end of the column of template names add yours, don't forget the comma after the last one that's already there, like so:

PHP Code:

'already_there_template',
'template_you_need_cached' 


zetetic 05-24-2005 11:50 PM

Good tip, Dennis. :)

However I'm pretty sure you should only do that for templates that are used on every page of your site. You can conserve memory by adding page specific and action specific templates to the $globaltemplates and $actiontemplates arrays (respectively) at the beginning of the file that uses them instead of adding them to global.php. Profile.php and usercp.php are good files to look at to see examples of this.

Zachery 05-25-2005 02:00 AM

Quote:

Originally Posted by tmhall
Good tip, Dennis. :)

However I'm pretty sure you should only do that for templates that are used on every page of your site. You can conserve memory by adding page specific and action specific templates to the $globaltemplates and $actiontemplates arrays (respectively) at the beginning of the file that uses them instead of adding them to global.php. Profile.php and usercp.php are good files to look at to see examples of this.

Not all templates should be cached globally however.

zetetic 05-25-2005 04:04 PM

Quote:

Originally Posted by Zachery
Not all templates should be cached globally however.

Isn't that what I just explained, or do you mean something else?

Zero Tolerance 05-25-2005 05:10 PM

I think Zac only read the opening line to your post :p

- Zero Tolerance

deathemperor 05-25-2005 05:34 PM

I believe there're at least 2 threads for this...

zetetic 05-25-2005 06:56 PM

Quote:

Originally Posted by Zero Tolerance
I think Zac only read the opening line to your post :p

I hope so! I thought I was going crazy. :D

Quote:

Originally Posted by deathemperor
I believe there're at least 2 threads for this...

I don't think we're in danger of having too many useful threads here. :)

dsboyce8624 05-30-2005 05:33 AM

Quote:

Originally Posted by deathemperor
I believe there're at least 2 threads for this...

Well, I couldn't find them. I found this info in the instructions for a hack.

Quote:

Originally Posted by tmhall
Good tip, Dennis. :)

However I'm pretty sure you should only do that for templates that are used on every page of your site. You can conserve memory by adding page specific and action specific templates to the $globaltemplates and $actiontemplates arrays (respectively) at the beginning of the file that uses them instead of adding them to global.php. Profile.php and usercp.php are good files to look at to see examples of this.

I will have to check this out. As I said above, I'm new to this. Everybody I asked about it said "Go ask whoever wrote the hack" and the hack was very old and unsupported. So I figured it out. But with your statement in here, I guess all the info is now available in one place! :banana:

zetetic 05-30-2005 06:05 AM

I stumbled on this post at vb.com earlier tonight. It's a couple years old but as far as I know it's still relevant. It gives a little more detail about the purpose of the different template arrays. :)

Gizmo5h1t3 08-14-2005 08:35 PM

Quote:

Originally Posted by deathemperor
I believe there're at least 2 threads for this...

then post the links for em, coz i cant find em mate.

try to help out a bit more, instead of bunging up witty repartee.
if it was funny i wouldnt mind...

ezak 07-18-2009 07:34 PM

thanks for that great hack
but the templates are not cached,
how to cache the template

Powered by vBulletin® Version 3.8.3, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Page generated in 0.52030 seconds with 28 queries (2 queries for uncached templates)
Uncached templates: nlp_notifications_usercp (1)
Uncached templates: nlp_notifications_usercp_bit (1)

Lynne 07-18-2009 07:57 PM

I am pretty sure there is a more recent version of this article that shows how to cache the templates using plugins.

HMBeaty 07-18-2009 08:11 PM

Quote:

Originally Posted by ezak (Post 1851299)
thanks for that great hack
but the templates are not cached,
how to cache the template


Powered by vBulletin? Version 3.8.3, Copyright ?2000 - 2009, Jelsoft Enterprises Ltd.
Page generated in 0.52030 seconds with 28 queries (2 queries for uncached templates)
Uncached templates: nlp_notifications_usercp (1)
Uncached templates: nlp_notifications_usercp_bit (1)

You could create a plugin with the hook location cache_templates and in the box for the Plugin PHP Code you would insert this code
PHP Code:

$globaltemplates[] = 'nlp_notifications_usercp';
$globaltemplates[] = 'nlp_notifications_usercp_bit'

Hope that helps :)

ezak 07-19-2009 09:04 PM

Quote:

Originally Posted by Redlinemotorsports (Post 1851324)
You could create a plugin with the hook location cache_templates and in the box for the Plugin PHP Code you would insert this code
PHP Code:

$globaltemplates[] = 'nlp_notifications_usercp';
$globaltemplates[] = 'nlp_notifications_usercp_bit'

Hope that helps :)

thanks alot bro its really working as well

KURTZ 06-25-2010 11:29 AM

Quote:

Originally Posted by Lynne (Post 1851316)
I am pretty sure there is a more recent version of this article that shows how to cache the templates using plugins.

i'm looking for it (for vB 4) ... i've searched but i can't find anything ...

Lynne 06-25-2010 01:53 PM

Quote:

Originally Posted by KURTZ (Post 2059327)
i'm looking for it (for vB 4) ... i've searched but i can't find anything ...

for vB4:
PHP Code:

$cache[] = 'your_template'

OR
PHP Code:

$cache  array_merge($cache, array(
     
'your_template1',
     
'your_template2',
     
'your_template3',
     
'your_template4',
     
'your_template5'
  
)); 


KURTZ 06-25-2010 04:55 PM

Quote:

Originally Posted by HMBeaty (Post 1851324)
You could create a plugin with the hook location cache_templates and in the box for the Plugin PHP Code you would insert this

Quote:

Originally Posted by Lynne (Post 2059390)
for vB4:
PHP Code:

$cache[] = 'your_template'

OR
PHP Code:

$cache  array_merge($cache, array(
     
'your_template1',
     
'your_template2',
     
'your_template3',
     
'your_template4',
     
'your_template5'
  
)); 


so i need to create a new plugin and then put the code that you give me Lynne? correct?

Lynne 06-25-2010 10:48 PM

Yes, you need to create a plugin to cache the templates.

KURTZ 06-27-2010 09:44 AM

perfect! runs correctly! :) as always thanks Lynne for the tips ;)


All times are GMT. The time now is 11:33 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.03811 seconds
  • Memory Usage 1,775KB
  • 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
  • (8)bbcode_php_printable
  • (13)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (19)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete