vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Question about $templatesused... (https://vborg.vbsupport.ru/showthread.php?t=52904)

cirisme 05-13-2003 07:25 PM

Question about $templatesused...
 
What's the easiest way to tell if a template is being called that is not on the templatesused list?

Boofo 05-13-2003 07:32 PM

Look in the php file. ;)

cirisme 05-13-2003 07:56 PM

Hehehehe, I was hoping for a log or something. Oh well. ;)

rake 05-13-2003 08:19 PM

use explain=1 on pages. Look for a query like SELECT * FROM template WHERE title IN (blah,blahblah,blahblah) ;)

Boofo 05-13-2003 09:27 PM

Or you could do that. ;)

filburt1 05-13-2003 09:35 PM

You can also very easily modify gettemplate to echo the names of uncached templates when they're eval'ed. That's what I do on my test board to make sure $templatesused is correct.

Boofo 05-13-2003 09:50 PM

How would you do that? I'd like to try it.

filburt1 05-13-2003 10:23 PM

I don't have a reference vB2 functions.php ATM but if you have my embed PHP tags in templates hack installed, find:
PHP Code:

    if (isset($templatecache[$templatename]))
    {
        
$toreturn $templatecache[$templatename];
    }
    else
    {
        
$template $DB_site->query_first("SELECT template FROM template
            WHERE title = \"" 
addslashes($templatename) . "\"
            AND (templatesetid = -1 OR templatesetid = 
$templatesetid)
            ORDER BY templatesetid DESC LIMIT 1"
);
        
$toreturn $template['template'];
        
$templatecache[$templatename] = $toreturn;
    } 

Replace with:
PHP Code:

    if (isset($templatecache[$templatename]))
    {
        
$toreturn $templatecache[$templatename];
    }
    else
    {
        echo 
"Template <b>$templatename</b> wasn't cached!<br>";
        
$template $DB_site->query_first("SELECT template FROM template
            WHERE title = \"" 
addslashes($templatename) . "\"
            AND (templatesetid = -1 OR templatesetid = 
$templatesetid)
            ORDER BY templatesetid DESC LIMIT 1"
);
        
$toreturn $template['template'];
        
$templatecache[$templatename] = $toreturn;
    } 


Boofo 05-13-2003 10:34 PM

Here's what I have for that code:

PHP Code:

  if (isset($templatecache[$templatename])) {
    
$template=$templatecache[$templatename];
  } else {
    
$gettemp=$DB_site->query_first("SELECT template FROM template WHERE title='".addslashes($templatename)."' AND (templatesetid=-1 OR templatesetid=" intval($templatesetid). ") ORDER BY templatesetid DESC LIMIT 1");
    
$template=$gettemp[template];
    
$templatecache[$templatename]=$template;
 } 


filburt1 05-13-2003 11:36 PM

Then right above that query, add:
PHP Code:

echo "<b>$templatename</b> isn't cached!<br>"



All times are GMT. The time now is 10:04 AM.

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.01066 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
  • (4)bbcode_php_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