Hi
I am using VirtualPages extensively in our website. With
upgrading to 3.3 I found that they are now all rendering their
pages using the Page.ss layout ... instead of the Layout
corresponding to the page they are pointing to.
I was able to 'fix' the problem for now with this ugly ugly patch:
diff --git a/code/controllers/ContentController.php b/code/controllers/ContentController.php
index 944ce5e..5952a3b 100755
--- a/code/controllers/ContentController.php
+++ b/code/controllers/ContentController.php
@@ -385,6 +385,14 @@ HTML;
SSViewer::get_templates_by_class(get_class($this->dataRecord), "", "SiteTree"),
SSViewer::get_templates_by_class(get_class($this), "", "Controller")
);
+ echo "<!--";
+ var_dump($templates);
+ echo "-->";
+ # compensate for Page being the first option returned by VirtualPages
+ # ... this is rather ugly
+ if ($templates[0] == 'Page'){
+ array_shift($templates);
+ }
return new SSViewer($templates);
}
While normal pages get the Page Class name as the first item listed
in $templates, VirtualPages get 'Page' as the first option and if
there is layout called Page.ss it will be picked up.
I guess I am doing something badly wrong here since I can not find
anyone else reporting this ... but what?
cheers
tobi
--
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
www.oetiker.ch to...@oetiker.ch +41 62 775 9902