Description: I originally had this bright idea to write up a detailed guide to putting php in your TPLs, but my schoolwork is keeping me from doing anything decent.
Please note that I have not had the chance to try this out, but according to the Template Power web site it is possible. The keyword throughout this entire post is "should" -- meaning theoretically, it should work.
At any rate, there are two ways you can do this easily. The way you do it depends on how ambitious you're feeling. This should work in both 2.0 and 1.1, but again -- don't quote me on that.
As usual, please be sure to make backups in case I'm wrong. ^^;;
Requirements: eFiction 2.0+, eFiction 3.0+, Template Power 3.01 (should already be included)
Modification History:
May 31, 2006: Released untested instructions for eFiction 2.0
Instructions:
The Easy Way
By far, the easiest command to embed a PHP script in your tpl is:
Code:
-
<!-- INCLUDESCRIPT BLOCK : ./yourscript.php -->
Simply put your php in a separate file with a .php extension and upload it to your server. Then open the .tpl file where you want the script to appear and pop the above code into it. Make sure you name the file appropriately and that your path is correct.
Otherwise, you should be all set.
The Hard Way
Or should I call this the elegant way? This assigns the script much the same way you would for a file or a block.
First of all, you need to determine where you want the file to go. For the sake of brevity, I'm going to write this as if I'm including a fictional shoutbox onto my index page.
Open up index.php and add the following line:
Code:
-
$tpl->assignInclude( "shoutbox", "./shout.php" );
That defines the script, but it's not going to work unless you call it properly. Save your file.
Now, open up your index.tpl and pop this where you want the shoutbox to appear:
Code:
-
<!-- INCLUDESCRIPT BLOCK : shoutbox -->
As usual, make sure your paths are correct and you know what you're calling and where. You may have to experiment a bit to get this way to work.
And that should do it. I pulled this from the TemplatePower manual and their Basics Guide, which says both methods should work in the version of template power we're using.
Save, upload, and enjoy!
|
|

