PDA

View Full Version : Phpinclude questions (filburt?)


Dean C
05-28-2003, 03:35 PM
1/ If i'm calling templates in phpinclude, i don't want it adding a query to every page so should i use the $templatesused variable in the phpinclude too?

2/ How do i limit the code to running only when on a certain file:

e.g.


$lala = echo("blah");


If i wanted that only to apply to showthread.php what would i do :)?

Thanx

- miSt

filburt1
05-28-2003, 03:45 PM
1. $templatesused must be defined before global.php is included, so that won't work (you can't cache templates via phpinclude).
2. Check out PAPI at vBT and use:

if (this("showthread'))
{
doStuff();
}

...or if you don't want PAPI:

if (preg_match("/^.*\/showthread\.php$/", $_SERVER['PHP_SELF']))
{
doStuff();
}

Dean C
05-28-2003, 05:11 PM
Yep this for a client hence why i am reluctant to install hacks for him as i don't want him coming back to me when he tries to upgrade and loses his hacks :p

Is there any way of cacheing the templates at all without hacking?

I mean adding a query to the pages is a bit of a pain :)

- miSt

filburt1
05-28-2003, 05:22 PM
No, there's no way unless you use a template that's already cached but never eval'ed.

Dean C
05-28-2003, 05:36 PM
Darn - well thanks for the help ;)

- miSt