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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Template not found


Reply


770 Views

Avatar
k0m0r

Community Member, 39 Posts

23 April 2010 at 10:19pm

Hi.
I just encountered a strange behaviour of template renderer.
My Page_Controller looks as follows:

class Page_Controller extends ContentController {
function xml() {
$this->getResponse()->addHeader('Content-Type', 'application/xml; charset="utf-8"');
return array();
}
}

And then I have several page types extending both Page and Page_Controller, so I can use different templates. But for a strange reason one of my subclasses does not find an existing template.
I have templates/Page_xml.ss template that looks like these:

<page id="$ID">
$Layout
</page>

And in templates/Layout folder, for example:

ExamplePage.ss
ExamplePage_xml.ss
TestPage.ss
TestPage_xml.ss

When calling example-page/xml, it renders correctly using Page_xml.ss and Layout/ExamplePage_xml.ss
But for a strange reason one of my subclasses, let's say TestPage, cannot find an existing TestPage_xml.ss template, so it renders using Page_xml.ss and then TestPage.ss (not TestPage_xml.ss).
Every other class in the project works perfectly.

I triple checked everything for typos and anything. Does anyone encountered this problem?
I tried deleting the pages, the classes, rebuilding the database, flushing templates - no can do, my existing TestPage_xml template is simply ignored.
What could I miss?