Adding php instruction to template [solved]

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
crackmedia

Adding php instruction to template [solved]

Post 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.
Last edited by crackmedia on Thu Aug 16, 2007 7:55 pm, edited 1 time in total.
User avatar
Nullig
Power Poster
Power Poster
Posts: 2380
Joined: Fri Feb 02, 2007 4:31 pm

Re: Adding php instruction to template

Post 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
Last edited by Nullig on Thu Aug 16, 2007 7:19 pm, edited 1 time in total.
crackmedia

Re: Adding php instruction to template

Post by crackmedia »

Thanks for that, UDT worked a treat.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Adding php instruction to template [solved]

Post by Dr.CSS »

Add [solved] to the original post subject line Please....
Locked

Return to “CMSMS Core”