Template inclusion

General project discussion. NOT for help questions.
Post Reply
gregwar
New Member
New Member
Posts: 2
Joined: Wed Apr 15, 2009 10:25 am

Template inclusion

Post by gregwar »

Hi, I'm a new user of CMSMS and i got some question (i appologize if my english is bad, i am french)

I'm using custom templates, but i want to use template pretty much similar on different pages (only some zones are differents). Can i create a template and "include" it in the others ?


Thanks!
uniqu3

Re: Template inclusion

Post by uniqu3 »

You can export the Template as xml file under "Layou/Theme Manager" and then import it on the new Website.
gregwar
New Member
New Member
Posts: 2
Joined: Wed Apr 15, 2009 10:25 am

Re: Template inclusion

Post by gregwar »

I think i didn't explain very well my problem :)
Can I for example create a template "header" with the doctype, the metas etc. and include it frome other templates with a smarty tag ?
vilkis

Re: Template inclusion

Post by vilkis »

You can create Global Content Blocks and then include them in templates.

Vilkis
tyman00
Power Poster
Power Poster
Posts: 906
Joined: Tue Oct 24, 2006 5:59 pm

Re: Template inclusion

Post by tyman00 »

You don't normally include one template inside of another. But you do have a few options.

1. Create your template and then make copies and make the necessary adjustments depending on the template. Then you can select the template you with to use when you create the page.

2. Create one single template and use Smarty logic to display certain information depending on the current page information. For example I use smarty logic to check for certain page aliases and it displays different information on my site. You can also put the "extra1, extra2, extra3" fields to use here. You can specify something in one of those fields and then use smarty to display your different information depending on the value of those fields.

3. Follow vilkis' idea to a certain extent. Create varrying Global Content Blocks. The only problem is you need to specify which block to use to display the proper header data. You can again use the "extra" fields. In one of those fields you can specify the names of the global content block you would like to use in the header. If you do it right you can also specify a default content block to use if one is accidentally not specified.
If all else fails, use a bigger hammer.
M@rtijn wrote: This is a community. This means that we work together and have the same goal (a beautiful CMS), not that we try to put people down and make their (voluntary) job as difficult as can be.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Template inclusion

Post by Dr.CSS »

Your doctype should be consistent throughout your site so no need to do that, you can add page specific metadata using the meta box in the options tab when editing/making a page, you can use {$page_alias} in a class call to make the pages have different looks depending on what page you are on...

So actually you don't need a lot of different templates to do what you want, try not to over complicate your life...
Post Reply

Return to “General Discussion”