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:

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

Page property access in Controller


Go to End


756 Views

Avatar
Lazarus404

Community Member, 72 Posts

27 May 2011 at 12:06am

Hi guys,

Okay, so, I've decided, to make life easy for the site admin, to default custom properties in a new page to match that of the home page. This way, the page doesn't look nasty if they've forgotten to add anything. This works great for single items, as I can just use

<% if Property %>
show
<% else %>
<% control Page(home) %>
show
<% end_if %>

However, a problem arises if the property is an array, as I can't nest control statements, and using

<% control Page(home).Property %>

doesn't work. The question is, then; how can I use the property of some other page in a control statement in a template?

Thanks,
Lee