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]


Reply


2 Posts   2322 Views

Avatar
servalman

Community Member, 211 Posts

23 June 2010 at 4:43am

Edited: 23/06/2010 5:49am

Hello

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

Avatar
Willr

Forum Moderator, 5513 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

$ToTo;