Page 1 of 1

Including Templates

Posted: Tue Jan 23, 2007 8:32 pm
by stunz
Hi,

i've tried a search and couldn't find the answer i'm after.

I use Smarty on a regular basis, and use common header and footer templates, so a typical page will be of the form:

{include file='head.tpl' title='Welcome'}
This is the content
{include file='base.tpl}

I see cmsms stores in the database, how can you create common headers and footers?  The project i'm doing requires this functionality as there will be pages with different layouts but the top and bottom will be the same, and doing a site redesign would require updating many templates instead of just the header and footer.

I'm wanting to implement these as templates, creating them as php would be easy enough, but totally depletes the purpose of using smarty in the first place.

Any pointers would be appreciated thanks.

Re: Including Templates

Posted: Tue Jan 23, 2007 8:36 pm
by calguy1000
GCB's or User defined templates so you have something like:

{my_header}

{my_footer}

and of course, my_header, and my_footer could be shared amongst many different templates.

Re: Including Templates

Posted: Tue Jan 23, 2007 10:10 pm
by stunz
Hi,

I tried that and it didn't quite work as expected.  I had an example template with the following:

{header}

{footer}

Header and footer did not work as I assume it was looking for a user defined tag instead. 

I then tried {global_content name='header'}, this converted tags to html code.

What I will do is create a basic template, and create gcb's to place into the content pages to reflect the differences, I can work with that,

Thanks

Re: Including Templates

Posted: Tue Jan 23, 2007 11:28 pm
by Elijah Lofgren
stunz wrote: I then tried {global_content name='header'}, this converted tags to html code.

What I will do is create a basic template, and create gcb's to place into the content pages to reflect the differences, I can work with that,

Thanks
To stop if from converting the tags to HTML code you can turn off the WYSIWYG editor for GCBs by going to My Preferences » User Preferences and unchecking: Enable the WYSIWYG editor while editing Global Content Blocks.

Then it should work fine.

Hope this helps,

Elijah

Re: Including Templates

Posted: Tue Jan 23, 2007 11:38 pm
by stunz
Thanks

that did the trick ...