vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   ?? Uncached Template ?? (https://vborg.vbsupport.ru/showthread.php?t=173660)

PoetJA-1975 03-21-2008 12:47 AM

?? Uncached Template ??
 
Copied from vB.com: http://www.vbulletin.com/forum/showthread.php?t=262272


I have an uncached template from a recent modification I added (https://vborg.vbsupport.ru/showthread.php?t=171918)

http://img169.imageshack.us/img169/2...emplateaf8.gif

How can I make this template (and any other future uncached templates) cached so no unneccesary queries are called? I've tried editing the index.php file to include the template in the "pre-cache templates used by all actions" section:

Code:

// pre-cache templates used by all actions
$globaltemplates = array(
        'FORUMHOME',
        'forumhome_event',
        'forumhome_forumbit_level1_nopost',
        'forumhome_forumbit_level1_post',
        'forumhome_forumbit_level2_nopost',
        'forumhome_forumbit_level2_post',
        'forumhome_lastpostby',
        'forumhome_loggedinuser',
        'forumhome_moderator',
        'forumhome_subforumbit_nopost',
        'forumhome_subforumbit_post',
        'forumhome_subforumseparator_nopost',
        'forumhome_subforumseparator_post',
        'forumhome_markread_script'
);

The hook for cb_quickthread is global - so when editing the index.php to include the template - It only works on the main index.php and not all other pages. Question: how can I get the template to cache globally?

Thanx,

Jacquii.

sinisterpain 03-21-2008 01:07 AM

He should have added this plugin as well to the xml
Code:

<plugin active="1">
                        <title>Quick new thread Template Cache</title>
                        <hookname>cache_templates</hookname>
                        <phpcode><![CDATA[$globaltemplates[] = 'cb_quickthread';]]></phpcode>
                </plugin>

You can manually add the plugin yourself

PoetJA-1975 03-21-2008 06:54 AM

WONDERFUL! Thanx so much for you help!

Jacquii.

DivisionByZero 03-21-2008 07:42 AM

im lazy like that :)

Boofo 03-21-2008 08:26 AM

Tsk..Tsk.. Ryan. Shame on you. ;)

Opserty 03-21-2008 10:21 AM

If this template is only used on certain pages you show wrap the cache in a conditional for example if it was only the index.php page:

PHP Code:

if(THIS_SCRIPT == 'index')
{
    
$globaltemplates[] = 'cb_quickthread';


Or multiple selected pages:
PHP Code:

if(in_array(THIS_SCRIPT, array('index''showthread''newthread')))
{
    
$globaltemplates[] = 'cb_quickthread';


;)

Boofo 03-21-2008 11:17 AM

And how would you do something like both of those for multiple templates being cached?

Dismounted 03-21-2008 11:23 AM

PHP Code:

$globaltemplates array_merge($globaltemplates, array('template1''template2')); 


Opserty 03-21-2008 11:25 AM

Or:
PHP Code:

    $globaltemplates[] = 'template1';
    
$globaltemplates[] = 'template2'

I think it looks more organised that way :p Obviously only good for about 3-4 templates after which I prefer to go to Dismounted's method.

Boofo 03-21-2008 11:26 AM

Thank you, sir. I thought that should be included in case anyone stumbles onto this and won't have to ask for that now. ;)

Dismounted 03-21-2008 11:28 AM

Quote:

Originally Posted by Opserty (Post 1470636)
Or:
PHP Code:

    $globaltemplates[] = 'template1';
    
$globaltemplates[] = 'template2'

I think it looks more organised that way :p Obviously only good for about 3-4 templates after which I prefer to go to Dismounted's method.

If you want it to look organised...:p
PHP Code:

$mytemplates = array(
    
'template1',
    
'template2'
);
$globaltemplates array_merge($globaltemplates$mytemplates); 


Guest190829 03-21-2008 11:37 AM

Organized code? Who needs that! I like writing everything on one line.

Kirk Y 03-21-2008 02:25 PM

Quote:

Originally Posted by Danny.VBT (Post 1470646)
Organized code? Who needs that! I like writing everything on one line.

Seriously, same here. It's much better on the eyes - no looking up or down, just left and right.

ssslippy 03-21-2008 02:34 PM

This is a great reference thread.

Boofo 03-21-2008 02:38 PM

Quote:

Originally Posted by Kirk Y (Post 1470791)
Seriously, same here. It's much better on the eyes - no looking up or down, just left and right.

Then everything starts looking all run-together and makes editing things harder.

Lynne 03-21-2008 03:00 PM

Quote:

Originally Posted by ssslippy (Post 1470796)
This is a great reference thread.

Yes, it is. Thanks guys! :up:

PoetJA-1975 03-21-2008 08:37 PM

Quote:

Originally Posted by MisterPopularity (Post 1470508)
im lazy like that :)

Oooooo That's a shame :mad:

Quote:

Originally Posted by Boofo (Post 1470637)
Thank you, sir. I thought that should be included in case anyone stumbles onto this and won't have to ask for that now. ;)

Absolutely - Thanx for all the info YAWL ;)

Quote:

Originally Posted by ssslippy (Post 1470796)
This is a great reference thread.

ABSOLUTELY! :up:

Jacquii.

DivisionByZero 03-21-2008 08:42 PM

an uncached template isn't something to lose sleep over anyway. i never cache templates unless my work includes a custom file.

Kirk Y 03-21-2008 09:27 PM

Quote:

Originally Posted by MisterPopularity (Post 1471073)
an uncached template isn't something to lose sleep over anyway. i never cache templates unless my work includes a custom file.

It's a senseless query, especially as easy as it is to cache custom templates.

PoetJA-1975 03-22-2008 07:20 AM

Quote:

Originally Posted by MisterPopularity (Post 1471073)
an uncached template isn't something to lose sleep over anyway. i never cache templates unless my work includes a custom file.

OK - I'll remember that the next time I request support for one of your modifications :erm:

Jacquii.

Boofo 03-22-2008 07:44 AM

Quote:

Originally Posted by MisterPopularity (Post 1471073)
an uncached template isn't something to lose sleep over anyway. i never cache templates unless my work includes a custom file.

Very bad habit to get into, my friend. ;)

DivisionByZero 03-22-2008 07:55 AM

Quote:

Originally Posted by PoetJA-1975 (Post 1471400)
OK - I'll remember that the next time I request support for one of your modifications :erm:

Jacquii.

well if you read the product description, you'll see it isn't supported in the traditional sense. :) I only released it as a courtesy. Anything I release here (rare) with support will be bigger mods.

Boofo 03-22-2008 08:19 AM

You keep talking like that and I'm gonna want to download all your stuff and install it. Talk like that gets me hot! ;)

DivisionByZero 03-22-2008 08:23 AM

mhm

Boofo 03-22-2008 08:50 AM

Which means...? ;)

DivisionByZero 03-22-2008 08:55 AM

sound it out :)

Boofo 03-22-2008 09:07 AM

I forgot the sarcasm tags on my post, sorry about that. ;)

PoetJA-1975 03-22-2008 07:56 PM

Quote:

Originally Posted by MisterPopularity (Post 1471422)
well if you read the product description, you'll see it isn't supported in the traditional sense. :) I only released it as a courtesy. Anything I release here (rare) with support will be bigger mods.

That's not the point Dude - The point is I asked a simple question and you neglected to even put up a sarcastic front... Anyway - no problem and Yes - I do thank you again for sharing the modification with the Community - It's something that my Forum has needed for a long time and has helped substantially cut down the amount of emails from stooopid computer illiterates who thinks navigating JPiC Forum is difficult...

Jacquii.

Tourmeister 03-10-2009 04:36 AM

Quote:

Originally Posted by sinisterpain (Post 1470283)
He should have added this plugin as well to the xml
Code:

<plugin active="1">
                        <title>Quick new thread Template Cache</title>
                        <hookname>cache_templates</hookname>
                        <phpcode><![CDATA[$globaltemplates[] = 'cb_quickthread';]]></phpcode>
                </plugin>

You can manually add the plugin yourself

Would I save that code in a text file with an XML extension and then use the Plugin Manager to upload it? I get several uncached templates:

Uncached templates: Marquee_Text (1)
Uncached templates: quickreply_addon (1)
Uncached templates: smilies_quickreply (1)

Dismounted 03-10-2009 05:04 AM

Admin CP > Plugins & Products > Plugins Manager > [Add New Plugin]

Hookname: cache_templates
PHP Code:
PHP Code:

$globaltemplates array_merge($globaltemplates, array(
    
'Marquee_Text',
    
'quickreply_addon',
    
'smilies_quickreply'
)); 


ragtek 03-10-2009 05:05 AM

no

just create a plugin!
http://www.vbulletin.com/docs/html/add_plugin

Tourmeister 03-11-2009 06:29 PM

Thank you!!

hydn 08-08-2009 08:57 PM

Should work if you list it there. But you have to clear cache :)

linuxututs 11-12-2009 06:50 PM

This is a Great thread, but I found a much easier way of handling this issue.

I had it installed and forgot about it, and remembered it when I ran into these issues again after browsing this forum.

Check it out "ZH - Template Cache".

Just a awesome Mod People. Just add your uncached templates and your done. !! :)

Thanks,

webmastersitesi 02-27-2011 09:54 AM

Quote:

Originally Posted by Dismounted (Post 1764621)
Admin CP > Plugins & Products > Plugins Manager > [Add New Plugin]

Hookname: cache_templates
PHP Code:
PHP Code:

$globaltemplates array_merge($globaltemplates, array(
    
'Marquee_Text',
    
'quickreply_addon',
    
'smilies_quickreply'
)); 


thanbk you it saved me a query :D


All times are GMT. The time now is 05:57 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01314 seconds
  • Memory Usage 1,827KB
  • 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
  • (3)bbcode_code_printable
  • (8)bbcode_php_printable
  • (14)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (35)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