Using SilverStripe 3.1 I laid out the FrontPage page type, which goes through its children to create a large page with high scroll. It has different types of pages, and I refer to their templates by creating their controllers on the fly, adding to the Page class:
class Page extends SiteTree {
.....
function RenderAsChild($templateName = null) {
if(!$templateName) $templateName = $this->ClassName;
if(!$this->pageController){
$class = $this->ClassName . "_Controller";
$this->pageController = new $class($this);
}
return $this->pageController->renderForHolderPage($templateName);
}
and in the controller:
class Page_Controller extends ContentController {
....
function renderForHolderPage($templateName = null) {
if(!$templateName) $templateName = $this->ClassName;
return $this->renderWith(array($templateName));
}
This way, I can visualize the pages and easily manage their templates and special functions, while still processing them the same way in the template, for example:
<% loop $Children %>
<% if $ClassName = 'FancyPage' %>
$RenderAsChild
......
The fact is that I want to use the userforms extension in this way, but in the template in a loop or control it appears as a page. It doesn't seem to know anything about the form or object of the UserDefinedForm.
?