Jump to:

23490 Posts in 18996 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » adding php in template [solved]

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

Page: 1
Go to End
Author Topic: 1887 Views
  • servalman
    Avatar
    Community Member
    211 Posts

    adding php in template [solved] Link to this post

    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

  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: adding php in template [solved] Link to this post

    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;

    1887 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.