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   1034 Views

Avatar
DeklinKelly

Community Member, 197 Posts

4 July 2009 at 3:03am

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

Avatar
Willr

Forum Moderator, 5513 Posts

4 July 2009 at 9:44pm

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

Community Member, 60 Posts

19 January 2011 at 3:40am

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

Avatar
martimiz

Forum Moderator, 1132 Posts

19 January 2011 at 7:22am

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 %>