Version: 1.00, by filburt1
Developer Last Online: May 2007
Version: 2.3.x
Rating:
Released: 05-10-2003
Last Update: Never
Installs: 16
No support by the author.
This hack lets you embed PHP code in templates. Simply add your code between a <? (not a <?php) and ?> tag and it will be eval'ed. All variables will be referenced in the global scope.
If you're using my Usergroup Tags in Templates hack then you're going to have an extraordinarily difficult time installing this hack. However the clever hacker can tell what has changed in this version.
You can somewhat use this to do conditionals in templates. Theoretically, this will work:
Just make sure that the variable to the left of the = and the variable right after the ?> match. Note that the entire <? and ?> tag itself will be stripped from the final template.
This hack also enhances the comments delimiting templates (if that option is turned on) to include the character count and PHP block count of the specified template.
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
filburt, in your opinion does this render logician's conditionals hack obsolete? i'm fluent in php. i liked logician's conditionals a lot except that it was kinda slow..
I read through some of the other messages AFTER modifying/fixing the original script, I would have added the <?php ?> <php> </php> stuff but I can't be arsed. On a deadline for other stuff.
That said, attached is an updated version that uses output buffering (in case you want to echo text) and also fixes the str_replace that didn't do squat
Mail me at stephen AT natnet DOT com if you want to say thanks or have questions, today was my first day on the board and I probably won't be back (fixed for a client who wanted to use phpAdsNew).
I read through some of the other messages AFTER modifying/fixing the original script, I would have added the <?php ?> <php> </php> stuff but I can't be arsed. On a deadline for other stuff.
That said, attached is an updated version that uses output buffering (in case you want to echo text) and also fixes the str_replace that didn't do squat
Mail me at stephen AT natnet DOT com if you want to say thanks or have questions, today was my first day on the board and I probably won't be back (fixed for a client who wanted to use phpAdsNew).
With these modifications, the hack works like a charm for what I needed it to do, which was to pull a php file into the header template via include(). the original hack would pull the file into the page but only at the top of the page and not where it was supposed to display.
For everyone else that had a similar problem, try this version. My thanks to both authors that worked on this.