Page 1 of 1

Adding php instruction to template [solved]

Posted: Thu Aug 16, 2007 6:12 pm
by crackmedia
Hello,

I'm trying to add a php randomize instruction into the template.

It works just fine on a .php page but not in the template.

.jpg" width="215" height="110" alt="Header Image" />

Is this possible please?

CMSMS ver 1.1

cheers.

Re: Adding php instruction to template

Posted: Thu Aug 16, 2007 7:15 pm
by Nullig
You have to have it enabled in your config.php and the syntax is:

{php}
your code
{/php}

or, alternatively, you may be able to do it using a UDT with your php code and call it in your template.

UDT named random

Code: Select all

echo(rand(1,6));

Code: Select all

src="http://www.longbarrow.co.uk/images/header_{random}.jpg"
Nullig

Re: Adding php instruction to template

Posted: Thu Aug 16, 2007 7:53 pm
by crackmedia
Thanks for that, UDT worked a treat.

Re: Adding php instruction to template [solved]

Posted: Fri Aug 17, 2007 1:41 am
by Dr.CSS
Add [solved] to the original post subject line Please....