I have three page type, 'MainPage' has 5 'PageHolder', each 'PageHolder' has number of 'QuestionPage'
on the MainPage.ss I need to access $link of current child 'PageHolder' $Link, inside the custom control of 'firstQuestion'
<% if Children %>
<% control Children %>
<% if firstQuestion %>
<p>
<h2>$PersonaType</h2><br>
<% control firstQuestion %>
<h4>"$Question"</h4> <br>
$Enquirer <br><br>
Previous Questions:
//I need to access this link
<a href="$Children.Link">View All</a>
<br><br>
<% end_control %>
<% if secondAndThirdQuestion %>
<% control secondAndThirdQuestion %>
<a href="$Link">$Question</a> <br>
<% end_control %>
<% end_if %>
</p>
<br>
<hr>
<br>
<% end_if %>
<% end_control %>
<% end_if %>
the firstQuestion is inside the 'PageHolder'
public function firstQuestion(){
return DataObject::get("QuestionPage", "ParentID={$this->ID}", '', '', '0, 1');
}
I am trying to add another function
public function currentPageHolder(){
return $this->Link();
}
Could someone please shed some light on this. Thank you.