Including Templates

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
stunz

Including Templates

Post 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.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Including Templates

Post 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.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
stunz

Re: Including Templates

Post 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
User avatar
Elijah Lofgren
Power Poster
Power Poster
Posts: 811
Joined: Mon Apr 24, 2006 1:01 am

Re: Including Templates

Post 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
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. :)
stunz

Re: Including Templates

Post by stunz »

Thanks

that did the trick ...
Locked

Return to “CMSMS Core”