You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Amit Gadaley <am...@hotwaxsystems.com> on 2017/12/11 16:00:05 UTC

*.html file rendering in OFBiz screen

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>

Re: *.html file rendering in OFBiz screen

Posted by Todd Thorner <tt...@infotinuum.com>.
+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.


Re: *.html file rendering in OFBiz screen

Posted by Jacques Le Roux <ja...@les7arts.com>.
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.
>>
>>
>
>


Re: *.html file rendering in OFBiz screen

Posted by Nicolas Malin <ni...@nereide.fr>.
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.
>
>


Re: *.html file rendering in OFBiz screen

Posted by Todd Thorner <tt...@infotinuum.com>.
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.
>
>


Re: *.html file rendering in OFBiz screen

Posted by Michael Brohl <mi...@ecomify.de>.
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.