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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

If method=post (.ss template)


Go to End


4 Posts   1330 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, 5523 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, 1391 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 %>