Page 1 of 1

How can I include a template in another template?

Posted: Tue Feb 17, 2009 2:57 pm
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

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

Posted: Tue Feb 17, 2009 11:46 pm
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?

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

Posted: Wed Feb 18, 2009 1:14 am
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 ;)

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

Posted: Wed Feb 18, 2009 9:45 am
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.

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

Posted: Wed Feb 18, 2009 2:49 pm
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

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

Posted: Wed Feb 18, 2009 2:57 pm
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.

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

Posted: Wed Feb 18, 2009 3:13 pm
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! :)