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

Call parent functiony in child template


Go to End


2 Posts   1945 Views

Avatar
sweetlaura

Community Member, 2 Posts

5 June 2009 at 9:44pm

How can I call a function of the parent of the actual class inside my template.
This try failes miserably:

<% control $Parent.MyFunction() %>
... doe doe doe ...
<% end_control %>

Avatar
Ben Gribaudo

Community Member, 181 Posts

6 June 2009 at 4:52am

Try

<% control Parent %>
// code in here is now working with the parent of the current page
<% end_control %>

Hope this helps,
Ben