vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   What's the plugin equivalent for THIS_SCRIPT? (https://vborg.vbsupport.ru/showthread.php?t=249212)

BirdOPrey5 08-24-2010 12:50 AM

What's the plugin equivalent for THIS_SCRIPT?
 
I know how to use THIS_SCRIPT in a template conditional- how can I use it in a plugin...

if (something = "my_script") ?

thnx.

Lynne 08-24-2010 02:43 AM

THIS_SCRIPT is a variable defined at the top of a php page such as this in index.php:
PHP Code:

define('THIS_SCRIPT''index'); 

I don't really know what to suggest other than a custom variable without knowing a bit more about what you are trying to do.

BirdOPrey5 08-24-2010 02:53 AM

I have a plugin, I only want code to execute if the page being displayed is a specific page... say showthread....

In a template I'd use:
<if condition="THIS_SCRIPT == 'showthread'">
blah blah blah
</if>

but in a plugin :
if {THIS_SCRIPT == "showthread")
{
blah blah blah
}
doesn't work... is their an equivalent condition I can use in a plugin to see what script I'm in.

I understand I could use a hook location native to the script I want to use but for various reasons that is not an option.

Lynne 08-24-2010 03:18 AM

PHP Code:

if (THIS_SCRIPT == 'showthread') {
stuff



BirdOPrey5 08-24-2010 12:47 PM

Damn... was hoping you weren't going to say that b/c then my code isn't working... oh well... thanks for the confirmation.


All times are GMT. The time now is 07:58 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.00986 seconds
  • Memory Usage 1,715KB
  • 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_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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