[how to]how to include templates in templates

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Locked
cloudyfa

[how to]how to include templates in templates

Post by cloudyfa »

I am newbie to this system
I created two templates in layout.one called "main",and another called "footer",I want to include "footer" template in "main".

Tried {template name="footer"},but not work,is there anybody how to include another template or is there any way to do this.
I can't find the answer in documents.
cyberman

Re: [how to]how to include templates in templates

Post by cyberman »

Have you tried

Code: Select all

{include file="footer.tpl"}
http://smarty.php.net/manual/en/languag ... nclude.php
cloudyfa

Re: [how to]how to include templates in templates

Post by cloudyfa »

cyberman wrote: Have you tried

Code: Select all

{include file="footer.tpl"}
http://smarty.php.net/manual/en/languag ... nclude.php
thanks cyberman.
yes,it's a solution,but you have to save a template file in server in this way.
I mean if I create templates in admin panel,can they include each other?
cyberman

Re: [how to]how to include templates in templates

Post by cyberman »

cloudyfa wrote: I mean if I create templates in admin panel
You can use this tool for editing files in CMSms backend :)

http://dev.cmsmadesimple.org/projects/fileeditor/
cloudyfa

Re: [how to]how to include templates in templates

Post by cloudyfa »

cyberman wrote:
cloudyfa wrote: I mean if I create templates in admin panel
You can use this tool for editing files in CMSms backend :)

http://dev.cmsmadesimple.org/projects/fileeditor/
Cool~~,I'll check it ;D

PS:when I use {include file=filepath},I create a template folder in the root folder of cmsms,if I write a relative path.the file path is not "./template/file" or "../template/file",it is "../../template/file",quite strange,isn't it? :-\
cyberman

Re: [how to]how to include templates in templates

Post by cyberman »

cloudyfa wrote: if I write a relative path.the file path is not "./template/file" or "../template/file",it is "../../template/file",quite strange,isn't it? :-\
Maybe this helps for understanding

http://smarty.php.net/manual/en/template.resources.php
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: [how to]how to include templates in templates

Post by Dr.CSS »

You could make them Global Content Block then put them in template...
Locked

Return to “Layout and Design (CSS & HTML)”