Jump to:

23355 Posts in 17702 Topics by 2862 members

General Questions

SilverStripe Forums » General Questions » If method=post (.ss template)

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

Page: 1
Go to End
Author Topic: 940 Views
  • DeklinKelly
    Avatar
    Community Member
    197 Posts

    If method=post (.ss template) Link to this post

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

  • Willr
    Avatar
    Forum Moderator
    5482 Posts

    Re: If method=post (.ss template) Link to this post

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

  • MagicUK
    Avatar
    Community Member
    60 Posts

    Re: If method=post (.ss template) Link to this post

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

  • martimiz
    Avatar
    Forum Moderator
    1067 Posts

    Re: If method=post (.ss template) Link to this post

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

    940 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.