Page 1 of 1

Including PHP in templates doesn't seem to work?

Posted: Wed Apr 26, 2006 5:40 pm
by Been Told
I have tried to include a piece of PHP in a .tpl file and it just doesn't work...

I went along according to the following article:
http://area51.phpbb.com/docs/coding-gui ... templating
And when I put:

Code: Select all

<!-- PHP -->
echo "hello!";
<!-- ENDPHP -->
into a .tpl file, it is displayed as:
[quote]
echo "hello!";
[/quote]

What am I doing wrong?

I tried using <?php and ?> and the effect is the same.[/code]

Re: Including PHP in templates doesn't seem to work?

Posted: Wed Apr 26, 2006 5:55 pm
by jwunderly
Been Told wrote: I have tried to include a piece of PHP in a .tpl file and it just doesn't work...


It won't, as the templating engine doesn't know how to process php code.

You can either install the extreme styles mod or assign the php "output" to a variable in the appropriate php file and then reference the variable in the tpl file

Re: Including PHP in templates doesn't seem to work?

Posted: Wed Apr 26, 2006 6:06 pm
by Been Told
jwunderly wrote:
Been Told wrote:I have tried to include a piece of PHP in a .tpl file and it just doesn't work...


It won't, as the templating engine doesn't know how to process php code.

You can either install the extreme styles mod or assign the php "output" to a variable in the appropriate php file and then reference the variable in the tpl file

Thanks for the info.
I wonder why that isn't mentioned in the above guide? :( Do you happen to know where I can get an up to date version of that mod by the way?

Posted: Wed Apr 26, 2006 6:09 pm
by jwunderly

Posted: Wed Apr 26, 2006 6:18 pm
by Been Told
Thanks very very much for this. :)