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.

General Questions

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

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

adding php in template [solved]


2 Posts   1911 Views


23 June 2010 at 4:43am (Last edited: 23 June 2010 5:49am), Community Member, 211 Posts


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


23 June 2010 at 9:13am Forum Moderator, 5511 Posts

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