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

If method=post (.ss template)


Reply

4 Posts   962 Views

Avatar
DeklinKelly

4 July 2009 at 3:03am Community Member, 197 Posts

I want a conditional in my .ss template for if a page was accessed via method=post.

Avatar
Willr

4 July 2009 at 9:44pm Forum Moderator, 5511 Posts

You would have to write your function in php and then call it from the template. The template has no control for this.

Avatar
MagicUK

19 January 2011 at 3:40am Community Member, 60 Posts

How do you 'call' php from the template then? Thanks.

Avatar
martimiz

19 January 2011 at 7:22am Forum Moderator, 1091 Posts

You create a function in your Page controler, then call it from you template. Something like:

function IsPosted() {
// check and return false or true;
}

<% if IsPosted %>
...
<% end_if %>