How can I include a template in another template?

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.
Post Reply
alpeb
New Member
New Member
Posts: 8
Joined: Tue Feb 17, 2009 2:54 pm

How can I include a template in another template?

Post by alpeb »

Hi,

Is there a tag I can use to accomplish this? Something like {include} but where I can refer to the templates stored in the CMS database.

Thanks a million,
Alejandro
Andrew Prior
Forum Members
Forum Members
Posts: 247
Joined: Sun Oct 28, 2007 4:14 am

Re: How can I include a template in another template?

Post by Andrew Prior »

Not sure if this will fill the bill, but maybe you could take the relevant part of your second template and put it in a global content block?
alpeb
New Member
New Member
Posts: 8
Joined: Tue Feb 17, 2009 2:54 pm

Re: How can I include a template in another template?

Post by alpeb »

Andrew Prior wrote: Not sure if this will fill the bill, but maybe you could take the relevant part of your second template and put it in a global content block?
Yea, I tried that but the wysiwyg is messing up the markup, and I don't want to have to tell editors to disable the wysiwyg if they'll be editing that template, 'cause I know they'll forget ;)
Pierre M.

Re: How can I include a template in another template?

Post by Pierre M. »

Hello,

could you please explain more your use case ? I fail to understand why the GCB/UDT suggestion isn't OK for you and your WYSIWYG words let me think you are try to nest pages rather than include layout items.

Pierre M.
alpeb
New Member
New Member
Posts: 8
Joined: Tue Feb 17, 2009 2:54 pm

Re: How can I include a template in another template?

Post by alpeb »

Pierre M. wrote: Hello,

could you please explain more your use case ? I fail to understand why the GCB/UDT suggestion isn't OK for you and your WYSIWYG words let me think you are try to nest pages rather than include layout items.

Pierre M.
Hi Pierre,

What I want to do is to have a template for a footer, that I can include in other templates. I have some empty divs in that footer that are referred to by the stylesheet to draw some rounded corners, but as soon as somebody enters to edit that GBC, those empty divs vanish. Here's the markup for the footer:

Code: Select all

<div id="ft">
        <div id="ft_tl"></div>
        <div id="ft_tr"></div>
        <div id="ft_content">
            <div class="yui-gb">
                <div id="ft_column_1" class="yui-u first">
                    left column<br />
                </div>
                <div id="ft_column_2" class="yui-u">
                    center column<br />
                </div>
                <div class="yui-u">
                    <img src="images/footer_logo.gif" />
                </div>
            </div>
        </div>
        <div id="ft_b"></div>
    </div>
Having the footer be a regular template doesn't produce this problem, but I don't know how to have a given template include this footer template. I'm guessing it's gotta be something like {include file="db:footer"}, but I still can't make it work.

Thanks,
Alejandro
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: How can I include a template in another template?

Post by calguy1000 »

just use two gcb's..... one.... the parent, would have the empty divs.... and call another gcb (the child) with the stuff that people can modify.
Don't give permission for others to edit the parent gcb.
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.
alpeb
New Member
New Member
Posts: 8
Joined: Tue Feb 17, 2009 2:54 pm

Re: How can I include a template in another template?

Post by alpeb »

calguy1000 wrote: just use two gcb's..... one.... the parent, would have the empty divs.... and call another gcb (the child) with the stuff that people can modify.
Don't give permission for others to edit the parent gcb.
That's a great idea, I'll do that. Thanks! :)
Post Reply

Return to “CMSMS Core”