Forum Moderators: coopster

Message Too Old, No Replies

How to use PHP file as a template

Don't understand how I can do var subs & exec script code at the same time

         

androidtech

9:38 pm on Jan 10, 2004 (gmt 0)

10+ Year Member



I have a sub-directory that has all URL's directed towards it funneled to a
PHP script instead of a physical file (using .htaccess commands).

I want to be able to load a PHP file that I will use as a template, make
some variable substitutions, and then return the resulting document to the
visitor.

What I can't figure out is, how to 'execute' the PHP script code in the PHP
file that acts as a template.

If I use any of the PHP "open/load file" functions, I won't get the normal
expansion/execution of PHP script code like I would if the web server served
up the PHP file, right?

If I am correct about this, how can I make variable substitutions in a
desired PHP template file and still have the embedded PHP script code be
executed by the server?

thx

jatar_k

4:50 am on Jan 11, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



give include [ca.php.net] a try

include "/path/to/template.php";