*.html file rendering in OFBiz screen

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

*.html file rendering in OFBiz screen

Amit Gadaley
Hello Everyone,

OFBiz only supports the rendering of *.ftl files in OFBiz screens.
*.ftl files are same as *.html files with richer capabilities but sometimes
there are situations where a user needs to render only *.html files instead
of *.ftl files.

I have debugged the code and figure out that method '*renderHtmlTemplate*'
of HtmlWidget.java is responsible for rendering *.ftl files. I walked
through it and met with this condition:

if (location.endsWith(".ftl")) {
     // render file
} else {
    //return error
}

My proposal is to update this condition like this:

if (location.endsWith(".ftl") || location.endsWith(".html")) {
     // render file
} else {
    //return error
}

I have tested it and it is working fine. I don't see any harm in this
change.

Please share your inputs on this.
--
Thanks and Regards,
*Amit Gadaley <https://about.me/amit_gadaley>* | Senior Enterprise Software
Engineer
HotWax Commerce <http://www.hotwax.co/> by HotWax Systems
<http://www.hotwaxsystems.com/>
Plot no. 80, Scheme no. 78 Part 2, Near Brilliant Convention Center, Indore,
M.P., India - 452010
Cell phone: +91 958.459.3069

<https://about.me/amit_gadaley?promo=email_sig>
Reply | Threaded
Open this post in threaded view
|

Re: *.html file rendering in OFBiz screen

Michael Brohl-3
Hi Amit,

there seems to be a misunderstanding: ftl files are Freemarker template
files (hence the extension). They can contain any text and also html or
any other format along with the Freemarker language to deal with dynamic
data to be rendered. Using the Freemarker language is optional.

If you want to render a plain html file, you can just fill your template
with the html. The output of the ftl file rendered by OFBiz is send to
the client's browser and diplayed there.

There is no need for an extra extension handled in the HtmlWidget.

Regards,

Michael


Am 11.12.17 um 17:00 schrieb Amit Gadaley:

> Hello Everyone,
>
> OFBiz only supports the rendering of *.ftl files in OFBiz screens.
> *.ftl files are same as *.html files with richer capabilities but sometimes
> there are situations where a user needs to render only *.html files instead
> of *.ftl files.
>
> I have debugged the code and figure out that method '*renderHtmlTemplate*'
> of HtmlWidget.java is responsible for rendering *.ftl files. I walked
> through it and met with this condition:
>
> if (location.endsWith(".ftl")) {
>       // render file
> } else {
>      //return error
> }
>
> My proposal is to update this condition like this:
>
> if (location.endsWith(".ftl") || location.endsWith(".html")) {
>       // render file
> } else {
>      //return error
> }
>
> I have tested it and it is working fine. I don't see any harm in this
> change.
>
> Please share your inputs on this.


smime.p7s (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: *.html file rendering in OFBiz screen

Todd Thorner
In reply to this post by Amit Gadaley
+1 ... although this might be a better thread for the dev mailing list.


Bottom line: never try to make your customers adjust their processes
&amp; prerogatives to match your product/service, because that's how
bureaucracies conduct themselves.



On 17-12-11 08:00 AM, Amit Gadaley wrote:

> Hello Everyone,
>
> OFBiz only supports the rendering of *.ftl files in OFBiz screens.
> *.ftl files are same as *.html files with richer capabilities but sometimes
> there are situations where a user needs to render only *.html files instead
> of *.ftl files.
>
> I have debugged the code and figure out that method '*renderHtmlTemplate*'
> of HtmlWidget.java is responsible for rendering *.ftl files. I walked
> through it and met with this condition:
>
> if (location.endsWith(".ftl")) {
>       // render file
> } else {
>      //return error
> }
>
> My proposal is to update this condition like this:
>
> if (location.endsWith(".ftl") || location.endsWith(".html")) {
>       // render file
> } else {
>      //return error
> }
>
> I have tested it and it is working fine. I don't see any harm in this
> change.
>
> Please share your inputs on this.

Reply | Threaded
Open this post in threaded view
|

Re: *.html file rendering in OFBiz screen

Todd Thorner
In reply to this post by Michael Brohl-3
Ah, thanks very much for the explanation.



On 17-12-11 10:14 AM, Michael Brohl wrote:

> Hi Amit,
>
> there seems to be a misunderstanding: ftl files are Freemarker
> template files (hence the extension). They can contain any text and
> also html or any other format along with the Freemarker language to
> deal with dynamic data to be rendered. Using the Freemarker language
> is optional.
>
> If you want to render a plain html file, you can just fill your
> template with the html. The output of the ftl file rendered by OFBiz
> is send to the client's browser and diplayed there.
>
> There is no need for an extra extension handled in the HtmlWidget.
>
> Regards,
>
> Michael
>
>
> Am 11.12.17 um 17:00 schrieb Amit Gadaley:
>> Hello Everyone,
>>
>> OFBiz only supports the rendering of *.ftl files in OFBiz screens.
>> *.ftl files are same as *.html files with richer capabilities but
>> sometimes
>> there are situations where a user needs to render only *.html files
>> instead
>> of *.ftl files.
>>
>> I have debugged the code and figure out that method
>> '*renderHtmlTemplate*'
>> of HtmlWidget.java is responsible for rendering *.ftl files. I walked
>> through it and met with this condition:
>>
>> if (location.endsWith(".ftl")) {
>>       // render file
>> } else {
>>      //return error
>> }
>>
>> My proposal is to update this condition like this:
>>
>> if (location.endsWith(".ftl") || location.endsWith(".html")) {
>>       // render file
>> } else {
>>      //return error
>> }
>>
>> I have tested it and it is working fine. I don't see any harm in this
>> change.
>>
>> Please share your inputs on this.
>
>

Reply | Threaded
Open this post in threaded view
|

Re: *.html file rendering in OFBiz screen

Nicolas Malin-2
In reply to this post by Michael Brohl-3
Hi Amit,

If the necessity to have an clear identification for your ftl on what
you when to rendering it, you can name your file like this :
mytemplate.html.ftl

Nicolas

Le 11/12/2017 à 19:14, Michael Brohl a écrit :

> Hi Amit,
>
> there seems to be a misunderstanding: ftl files are Freemarker
> template files (hence the extension). They can contain any text and
> also html or any other format along with the Freemarker language to
> deal with dynamic data to be rendered. Using the Freemarker language
> is optional.
>
> If you want to render a plain html file, you can just fill your
> template with the html. The output of the ftl file rendered by OFBiz
> is send to the client's browser and diplayed there.
>
> There is no need for an extra extension handled in the HtmlWidget.
>
> Regards,
>
> Michael
>
>
> Am 11.12.17 um 17:00 schrieb Amit Gadaley:
>> Hello Everyone,
>>
>> OFBiz only supports the rendering of *.ftl files in OFBiz screens.
>> *.ftl files are same as *.html files with richer capabilities but
>> sometimes
>> there are situations where a user needs to render only *.html files
>> instead
>> of *.ftl files.
>>
>> I have debugged the code and figure out that method
>> '*renderHtmlTemplate*'
>> of HtmlWidget.java is responsible for rendering *.ftl files. I walked
>> through it and met with this condition:
>>
>> if (location.endsWith(".ftl")) {
>>       // render file
>> } else {
>>      //return error
>> }
>>
>> My proposal is to update this condition like this:
>>
>> if (location.endsWith(".ftl") || location.endsWith(".html")) {
>>       // render file
>> } else {
>>      //return error
>> }
>>
>> I have tested it and it is working fine. I don't see any harm in this
>> change.
>>
>> Please share your inputs on this.
>
>

Reply | Threaded
Open this post in threaded view
|

Re: *.html file rendering in OFBiz screen

Jacques Le Roux
Administrator
Yes we use that for JavaScript files we insert in screen for instance, like nameIt.js.ftl

Jacques


Le 11/12/2017 à 21:12, Nicolas Malin a écrit :

> Hi Amit,
>
> If the necessity to have an clear identification for your ftl on what you when to rendering it, you can name your file like this : mytemplate.html.ftl
>
> Nicolas
>
> Le 11/12/2017 à 19:14, Michael Brohl a écrit :
>> Hi Amit,
>>
>> there seems to be a misunderstanding: ftl files are Freemarker template files (hence the extension). They can contain any text and also html or any
>> other format along with the Freemarker language to deal with dynamic data to be rendered. Using the Freemarker language is optional.
>>
>> If you want to render a plain html file, you can just fill your template with the html. The output of the ftl file rendered by OFBiz is send to the
>> client's browser and diplayed there.
>>
>> There is no need for an extra extension handled in the HtmlWidget.
>>
>> Regards,
>>
>> Michael
>>
>>
>> Am 11.12.17 um 17:00 schrieb Amit Gadaley:
>>> Hello Everyone,
>>>
>>> OFBiz only supports the rendering of *.ftl files in OFBiz screens.
>>> *.ftl files are same as *.html files with richer capabilities but sometimes
>>> there are situations where a user needs to render only *.html files instead
>>> of *.ftl files.
>>>
>>> I have debugged the code and figure out that method '*renderHtmlTemplate*'
>>> of HtmlWidget.java is responsible for rendering *.ftl files. I walked
>>> through it and met with this condition:
>>>
>>> if (location.endsWith(".ftl")) {
>>>       // render file
>>> } else {
>>>      //return error
>>> }
>>>
>>> My proposal is to update this condition like this:
>>>
>>> if (location.endsWith(".ftl") || location.endsWith(".html")) {
>>>       // render file
>>> } else {
>>>      //return error
>>> }
>>>
>>> I have tested it and it is working fine. I don't see any harm in this
>>> change.
>>>
>>> Please share your inputs on this.
>>
>>
>
>