You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Vinay Agarwal <Vi...@hotmail.com> on 2006/07/18 18:32:21 UTC

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

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

 


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

Posted by Vinay Agarwal <Vi...@hotmail.com>.
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:oceatoon@gmail.com] 
Sent: Wednesday, July 19, 2006 1:59 AM
To: ofbiz-user@incubator.apache.org
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 <Vi...@hotmail.com> 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
>
>
>
>
>

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

Posted by tibor katelbach <oc...@gmail.com>.
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 <Vi...@hotmail.com> 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
>
>
>
>
>