Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 05-13-2003, 07:25 PM
cirisme cirisme is offline
 
Join Date: Jan 2003
Posts: 136
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Question about $templatesused...

What's the easiest way to tell if a template is being called that is not on the templatesused list?
Reply With Quote
  #2  
Old 05-13-2003, 07:32 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Look in the php file.
Reply With Quote
  #3  
Old 05-13-2003, 07:56 PM
cirisme cirisme is offline
 
Join Date: Jan 2003
Posts: 136
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hehehehe, I was hoping for a log or something. Oh well.
Reply With Quote
  #4  
Old 05-13-2003, 08:19 PM
rake's Avatar
rake rake is offline
 
Join Date: Nov 2002
Posts: 311
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

use explain=1 on pages. Look for a query like SELECT * FROM template WHERE title IN (blah,blahblah,blahblah)
Reply With Quote
  #5  
Old 05-13-2003, 09:27 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Or you could do that.
Reply With Quote
  #6  
Old 05-13-2003, 09:35 PM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #7  
Old 05-13-2003, 09:50 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How would you do that? I'd like to try it.
Reply With Quote
  #8  
Old 05-13-2003, 10:23 PM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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;
    } 
Reply With Quote
  #9  
Old 05-13-2003, 10:34 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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;
 } 
Reply With Quote
  #10  
Old 05-13-2003, 11:36 PM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Then right above that query, add:
PHP Code:
echo "<b>$templatename</b> isn't cached!<br>"
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:00 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.04933 seconds
  • Memory Usage 2,263KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete