17488 Posts in 4473 Topics by 1978 members
|Go to End|
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?
29 December 2007 at 3:36pm
Someone in #silverstripe helped me figure it out.
30 December 2007 at 11:07am
Great you learned how to do this. Would you mind sharing the titbit to help other helpless fools like myself?
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.
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="https:somewhere.com/process.php" 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:
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?
|Go to Top|