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.


Our old forums are still available as a read-only archive.

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

Best practice...


7 Posts   2554 Views


26 October 2006 at 7:39pm Community Member, 20 Posts

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?

Any hints?


27 October 2006 at 11:23am Administrator, 685 Posts

1) Put your template into templates/includes, for example, templates/includes/

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 it won't recognise the change until you put ?flush=1 on the URL.


4 November 2006 at 12:47am Community Member, 20 Posts

Hi Sam,

I've tried example you gave me but it doesn't work. Template named 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 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...


4 November 2006 at 10:09am Administrator, 685 Posts

Hmm.... email me your templates on and I'll take a look.


5 November 2006 at 8:13pm Forum Moderator, 921 Posts

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), Community Member, 20 Posts

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 Administrator, 685 Posts

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.