FTL: Is there a way to have a global template of macros

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

FTL: Is there a way to have a global template of macros

Vinay Agarwal
Hello,

 

I created some FTL macros that I would like make available to all my FTL
templates. Is there a way to create a global template for FTL? I tried

1. Screen.render: doesn't do it.  

2. Include seems to work only for files placed in that directory (even ../
etc. doesn't seem to work).

 

Thanks in advance,

Vinay Agarwal

 

Reply | Threaded
Open this post in threaded view
|

Re: FTL: Is there a way to have a global template of macros

oceatoon
Hi Vinay,

why not integrate it into your main decorator screen / widget definition
just like a header would be included everywhere.

<platform-specific><html><html-template
location="component://petitbateau/webapp/petitbateau/includes/macro.ftl"/></html></platform-specific>

Regards
Tibor

On 7/18/06, Vinay Agarwal <[hidden email]> wrote:

>
> Hello,
>
>
>
> I created some FTL macros that I would like make available to all my FTL
> templates. Is there a way to create a global template for FTL? I tried
>
> 1. Screen.render: doesn't do it.
>
> 2. Include seems to work only for files placed in that directory (even ../
> etc. doesn't seem to work).
>
>
>
> Thanks in advance,
>
> Vinay Agarwal
>
>
>
>
>
Reply | Threaded
Open this post in threaded view
|

RE: FTL: Is there a way to have a global template of macros

Vinay Agarwal
Including macros in header.ftl doesn't make those macros available for other
screens. What works quite well is something like this in header.ftl
        <#assign templateSrc = r"<#macro test>something here</#macro>" />
        <#assign template = templateSrc?interpret />
        ${request.setAttribute("template", template)}

Modify the files which want to use the macro "test" by inserting two line in
beginning and one line in the end as follows
<#assign template = requestAttributes.template />
<@template>
        .... file contents here
</@template>

Regards,
Vinay Agarwal


-----Original Message-----
From: tibor katelbach [mailto:[hidden email]]
Sent: Wednesday, July 19, 2006 1:59 AM
To: [hidden email]
Subject: Re: FTL: Is there a way to have a global template of macros

Hi Vinay,

why not integrate it into your main decorator screen / widget definition
just like a header would be included everywhere.

<platform-specific><html><html-template
location="component://petitbateau/webapp/petitbateau/includes/macro.ftl"/></
html></platform-specific>

Regards
Tibor

On 7/18/06, Vinay Agarwal <[hidden email]> wrote:

>
> Hello,
>
>
>
> I created some FTL macros that I would like make available to all my
> FTL templates. Is there a way to create a global template for FTL? I
> tried
>
> 1. Screen.render: doesn't do it.
>
> 2. Include seems to work only for files placed in that directory (even
> ../ etc. doesn't seem to work).
>
>
>
> Thanks in advance,
>
> Vinay Agarwal
>
>
>
>
>