Re: Multiple layout section override ?

Albert Kam <[email protected]> Sat, 9 Mar 2013 20:29:13 +0700
Newsgroups gmane.comp.web.freemarker.user
Message-ID <CAMT20g8CgChaZ1NApH7wdtQ8s2evfetRfnuFPbei+c-jj69rtw@mail.gmail.com>
Thanks for the guide Tony !

Actually i have thought of using the loop variable param,
but i wonder how to provide the default section content,
since what i intended is to override some sections as needed, and use the
default sections if not 'overriden'

Example :
for page1.ftl, i want to supply the body only, but use the default
left-panel, default header n default footer
for page2.ftl, i want to supply both the body and left-panel, and still use
the default header n default footer




On Sat, Mar 9, 2013 at 8:13 PM, Tony Schwartz <[email protected]>wrote:

>
> Sorry about that previous post!  I accidentally sent the email, I just love
> coding in a bad browser based email client!
>
>
>
>
> What I have done in the past is this:
>
>
> <#-- DEFINE THE MACRO -->
> <#macro layout>
>     <html>
>         <body>
>                 <div id="head"><#nested "head" /></div>
>                 <div id="content"><#nested "content" /></div>
>         </body>
>     </html>
> </#macro>
>
>
>
> <#-- NOW, CALL THE MACRO -->
> <@layout ; section>
>         <#if section = "head">
>                 Write your header section here.
>         <#elseif section = "content" >
>                 Write your content section here.
>         <#else>
>                 Unsupported section??
>         </#if>
> </@layout>
>
>
>
>
>
>
>
>
> On Sat, 09 Mar 2013 08:09:05 -0500, Tony Schwartz
> <[email protected]> wrote:
> > What I have done is this:
> >
> > <#macro layout>
> >     <html>
> >         <body>
> >         </body>
> >
> > </#macro>
> >
> >
> >
> >
> > On Wed, 6 Mar 2013 20:46:26 +0700, Albert Kam  wrote:  I am aware that i
> > can use macros for layouting, for example, a main layout that contains
> > header, left body section, center body section, footer.
> >  Based on the examples i have googled, like this one here
> >
>
> http://wendefer.blogspot.com/2007/09/handy-tip-for-layouts-in-freemarker.html
> > [1], i can use  in the main layout for dynamic values for other templates
> > that use this main layout macro.
> >  But in my case, i would like the other templates to be able to
> 'override'
> > more than 1 , for example, providing the content of left body section
> -and-
> > center body section (like apache tiles).
> >  Is this supported, or maybe is there any other approaches to do this ?
> >
> >  --
> > Do not pursue the past. Do not lose yourself in the future.
> > The past no longer is. The future has not yet come.
> >  Looking deeply at life as it is in the very here and now,
> > the practitioner dwells in stability and freedom.
> > (Thich Nhat Hanh)
> >
> > Tony Schwartz
> > [email protected]
> >
> >
> > Links:
> > ------
> > [1]
> >
>
> http://wendefer.blogspot.com/2007/09/handy-tip-for-layouts-in-freemarker.html
>
> --
> Tony Schwartz
> [email protected]
>
>
> ------------------------------------------------------------------------------
> Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester
> Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the
> endpoint security space. For insight on selecting the right partner to
> tackle endpoint security challenges, access the full report.
> http://p.sf.net/sfu/symantec-dev2dev
> _______________________________________________
> FreeMarker-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/freemarker-user
>



-- 
Do not pursue the past. Do not lose yourself in the future.
The past no longer is. The future has not yet come.
Looking deeply at life as it is in the very here and now,
the practitioner dwells in stability and freedom.
(Thich Nhat Hanh)

------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev

_______________________________________________
FreeMarker-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freemarker-user