Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

adding php in template [solved]

Go to End

2 Posts   4581 Views


Community Member, 211 Posts

23 June 2010 at 4:43am

Edited: 23/06/2010 5:49am


houpsssss ! I can not do it directly sorry for this post I don't know how to supress them

For some reason (passing a variable to a flash movie via flashvar) I have to insert a line of php inside a template :

Inserting flash object inside the template is pretty simple but writting something like

<? php $toto1='toto'; ?> seems not to work.

Maybe it is not possible

Thank you


Forum Moderator, 5523 Posts

23 June 2010 at 9:13am

You cannot use PHP in the templates. You must write your PHP functions / code in Page.php and call that from your template..

// mysite/code/Page.php 

function ToTo() { return 'toto'; }

// your template