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.

Archive /

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

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

Insection(page-url) control block


Reply


3 Posts   2821 Views

Avatar
a-tech

Community Member, 39 Posts

20 June 2007 at 3:57pm

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.

Avatar
elijahlofgren

Google Summer of Code Hacker, 222 Posts

21 June 2007 at 2:45am

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

Avatar
Sam

Administrator, 685 Posts

21 June 2007 at 10:31pm

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

<% if InSection(formpage) %>