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


All times are GMT. The time now is 09:54 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.01040 seconds
  • Memory Usage 1,742KB
  • 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
  • (2)bbcode_code_printable
  • (4)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)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