PDA

View Full Version : What's the plugin equivalent for THIS_SCRIPT?


BirdOPrey5
08-24-2010, 12:50 AM
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:
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
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.