17486 Posts in 4473 Topics by 1978 members
|Go to End|
26 October 2006 at 7:39pm
I'm wondering what is the best practice for including one template into another? I'm having site for which I want footer to be same across multiple page types/templates but so far I didn't manage to achieve this.
I'm aware of $layout and $content automatic inclusion but I want single include for all page types (not as $layout or $content)...
Also is there general include method for page templates?
27 October 2006 at 11:23am
1) Put your template into templates/includes, for example, templates/includes/MyTemplate.ss
2) Put <% include MyTemplate %> in the parent template. Don't include the extension.
3) Visit your page with ?flush=1 to pick up the new template. Note that there's currently a bug -- if you edit MyTemplate.ss it won't recognise the change until you put ?flush=1 on the URL.
4 November 2006 at 12:47am
I've tried example you gave me but it doesn't work. Template named FooterMenu.ss in my case is never included in main template I've checked manifest file in cache dir and file is found and included into array $_TEMPLATE_MANIFEST... But include in never done. Deleted cached verison of the parent page but no luck...
Another small thing. If this FooterMenu.ss contains some template code (getMenu() for instance, which existis in parent template) do I need to have page type for it?
I've tried that also but it didn't work but I want to know for future reference...
5 November 2006 at 8:13pm
Sam: I was working on a test site on my local machine at home. Everything seems to be working fine, but I also get the <% include blah %> problem too. Nothing ever seems to be getting included.
8 November 2006 at 3:58am Last edited: 8 November 2006 7:34pm
Somehow include does work now. I didn't do anything (just started writing you an email with templates) just tried again just to be sure before sending an email. Maybe my environment is broken in some less than obvious way which i can't detect...Some hidden cache? Are there any tests to certify that environment is installed properly?
8 November 2006 at 2:36pm
Other developers at the office have reported problems with caching and <% include %>d templates. I think I'm going to have to have a look at this for the next release.
|Go to Top|