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.

Data Model Questions /

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

Parent Controller-methods aren`t available in Custom Controller?

Go to End

10 Posts   3920 Views


Community Member, 17 Posts

18 August 2010 at 12:37am

Thanks for This!
We'll try that out and let you know here about our succsess!


Community Member, 28 Posts

25 September 2010 at 11:23pm

I had the same problem with my custom "Record-Page" (extends Page) and no access to my Methods that are defined in Record_Controller.

I saw this Entry:

so I add the Contoller manually to the DataObject.

function getFilterRecords() {
	$recordSet = DataObject::get("Record", "`SiteTree`.`ParentID` = '".$this->ID."'$additionalFilter");
	if (!$recordSet || !$recordSet->exists()) return false;
	// add controller
	foreach ($recordSet as $record) {
		$record->controller = ModelAsController::controller_for($record);
	return $recordSet;

In Template:

<% if FilterRecords %>
<% control FilterRecords %>
<h1>$Title</h1> <!--  access via -->

<p>$controller.MyControllerMethod</p><!-- access via the record_controller -->

<% end_control %>
<% end_if %>

I hope this could help too.

Go to Top