vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   How to know what template was loaded? (https://vborg.vbsupport.ru/showthread.php?t=229904)

RedFoxy 12-10-2009 11:43 AM

How to know what template was loaded?
 
Hi all!
I want write a plugin (admincp ->Plugins & Products -> Add New Plugin) to manage some variables that I'll print it in template, my code will prepare the variables only for the templates that will be loaded in current page, like, if the template "ad_showthread_firstpost_start" will be loaded in current page, my code will prepare the variables for that template, if the template "pm_messagelistbit" will be loaded, my code will prepare the variables for "ad_navbar_below" and not for "ad_showthread_firstpost_start" etc...

But to do that, I need to know what template will be loaded in current page... There is an array or something with current templates names? (not whole templates, only the group that will be loaded in current page)

mme42 12-10-2009 12:39 PM

There's a setting in the vbulletin options to show template names in the html source.

vBulletin Options > General Settings > Add Template Name in HTML Comments = Yes

You can then look at the html source and see the template names in html comments for whatever page.

Lynne 12-10-2009 02:06 PM

If you go into debug mode, then the list of templates used on each page it printed at the bottom of the page.

RedFoxy 12-10-2009 03:02 PM

I need in php not in HTML or debug and I need it to use to check if i must run a a code or another.

Like:
if ad_xyz is loaded then
$variable = "123445df";
else if ad_bass is loaded then
$variable "ambbma";
else
$variable = "qwerqqwer";
end if

kh99 12-10-2009 03:05 PM

If you know which templates are used in which php files, you could test the value of THIS_SCRIPT.

RedFoxy 12-10-2009 03:57 PM

there isn't an array or similar to know the template?

kh99 12-10-2009 04:19 PM

I think there are arrays which tell you what templates are cached, but that doesn't necessarily equal the templates that are actually used. There seems to be a number of arrays and I'm kind of fuzzy on that whole area. Probably Lynne knows the answer. :)

Lynne 12-10-2009 04:23 PM

Quote:

Originally Posted by kh99 (Post 1928431)
Probably Lynne knows the answer. :)

Nope. I've never looked into this before so I don't know the answer. :)


All times are GMT. The time now is 10:23 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,719KB
  • 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
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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