Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Insection(page-url) control block

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 2718 Views
  • a-tech
    Avatar
    Community Member
    39 Posts

    Insection(page-url) control block Link to this post

    Hey guys, I want to be able to limit a form to a specific page, without having to create a seperate page type I assume the best way is to use a control block that shows the form depending on what page the user is on.

    I tried
    <% if InSection("formpage") %>
          $someForm
    <% end_if %>

    but I get a parse error complaining about a missing } in the tmp file.

    Its not the code in the controller that the parse error is complaining about I have checked that.

  • elijahlofgren
    Avatar
    Google Summer of Code Hacker
    222 Posts

    Re: Insection(page-url) control block Link to this post

    You can do an if statement based on the "Page Name" field like this:

    <% if Title = Home %>
    WELCOME HOME!
    <% end_if %>

    That syntax is explained here under "If blocks": http://doc.silverstripe.com/doku.php?id=templates#template_syntax

    Hope this helps,

    Elijah

  • Sam
    Avatar
    Administrator
    679 Posts

    Re: Insection(page-url) control block Link to this post

    You shouldn't have quotes around formpage in the insection bit

    <% if InSection(formpage) %>

    2718 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.