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:

Archive /

Our old forums are still available as a read-only archive.

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


Go to End

5 Posts   2280 Views


Community Member, 5 Posts

29 December 2007 at 6:58am

I need to put some php into one of my .ss files (its a template) how to I tell ss to process it as .php and not .html?


Community Member, 5 Posts

29 December 2007 at 3:36pm

Someone in #silverstripe helped me figure it out.


Community Member, 24 Posts

30 December 2007 at 11:07am

Hi Jerome187,

Great you learned how to do this. Would you mind sharing the titbit to help other helpless fools like myself? :)



Forum Moderator, 801 Posts

5 January 2008 at 9:49pm

to follow up on the request: the underlying principles that silverstripe builds upon generally discourage putting too much logic into templates, thats why we have a intentionally restricted template language that doesn't parse PHP.
PHP-code belongs into the controller or model, which can both be accessed in the template by calling methods on them.

more information:


Community Member, 5 Posts

6 January 2008 at 4:01pm

pretty much you write a php function in the page controller then call it from your template. Unfortunately this only solved one problem for me, getting the captcha image to display (and validate too) but I ran into another problem when making a form that precesses credit cards via cybersource. Creating the form in php was a huge pain, and I could not even get it working, I could not find out how to change the action to something simple, like action="" I could make the form call a php function when it gets submitted but I did not know how to make php send a form to an address. Also in the form this code was necessary:

require_once ("HOP.php");
InsertSignature("$ammount", "usd")

I had no idea where to put that... I ended up making the order page outside of ss and using a page to redirect to it. Kinda lame cause its a static page and has to be edited everytime the site is changed from the cms. Does anyone know what I'm talking about and can anyone propose a better solution for this? I like SS, becides not allowing php in the templates... and making the forms, its nice for error checking but.... maybe if I knew how to use them better?