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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

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

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

Insection(page-url) control block

Go to End

3 Posts   3346 Views


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") %>
<% 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.


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

That syntax is explained here under "If blocks":

Hope this helps,



Administrator, 690 Posts

21 June 2007 at 10:31pm

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

<% if InSection(formpage) %>