3215 Posts in 848 Topics by 811 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 430 Views |
-
Template for code in sub directory

8 September 2011 at 4:32am
Hi,
I'm trying to organise my mysite/code folder by placing my code in sub directories, however when I do this SS defaults to using the Page.ss template.
For example I have the following file:
mysite/code/CaseStudies/ListPage.phpWhich contains the class:
CaseStudies_ListPageAnd I've tried putting the template in the following:
theme/ListPage.ss
theme/CaseStudies_ListPage.ss
theme/CaseStudiesListPage.ss
theme/CaseStudies/ListPage.ss
theme/Layout/CaseStudies_ListPage.ss
theme/Layout/CaseStudiesListPage.ss
theme/Layout/CaseStudies/ListPage.ssNone of which work. Can this be done or am I attempting the imposible?
-
Re: Template for code in sub directory

9 September 2011 at 1:32pm
The location of a class and the template location are quite disjoint. Actually class paths in general in SS are usually redundant since the autoloader loads all of the classes for you.
What is likely causing the issue here is your class name. SS uses an _ in templates to denote an action - i.e ClassName_Action.ss. So when it comes time to pick your CaseStudies_ListPage it may think ListPage is the action, not part of the CaseStudies.
I suggest using CaseStudiesListPage as your class name since convention would state that, or you may be able to explicitly define a template file on your class
static $template = 'CaseStudies_ListPage';
| 430 Views | ||
|
Page:
1
|
Go to Top |


