Replace ftl with html in ofbiz

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

Replace ftl with html in ofbiz

hoboy2
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Replace ftl with html in ofbiz

Nicolas Malin-2
Hi Can you explain more your problem ?

Because if you set only html code in a ftl file, it's work fine.

Nicolas

Le 28/01/2016 15:48, hoboy2 a écrit :

> Hi
>
> Ok I have partially asked this question before.
> I have looked into ofbiz doc I can not find an example
> of where to use html instead of ftl.
> I will like to use html instead of ftl
> any link ?
>
> Thanks
>
>
>
> --
> View this message in context: http://ofbiz.135035.n4.nabble.com/Replace-ftl-with-html-in-ofbiz-tp4676594.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: Replace ftl with html in ofbiz

Gil Portenseigne
In reply to this post by hoboy2
Hello,

In OFBiz ftl files contain html, if you read http://freemarker.incubator.apache.org/

You'll see that freemarker improve your html content with loop, variables, etc.

If you want to use pure static html, it could be done in screens with (not tested but i guess it works):

                        <platform-specific>
                            <html><html-template location="component://mycomponent/path/to/my/index.html"/></html>
                        </platform-specific>

Or be done in ftl files directly.

Regards

Gil


On 28/01/2016 15:48, hoboy2 wrote:
Hi

Ok I have partially asked this question before.
I have looked into ofbiz doc I can not find an example 
of where to use html instead of ftl.
I will like to use html instead of ftl 
any link ?

Thanks



--
View this message in context: http://ofbiz.135035.n4.nabble.com/Replace-ftl-with-html-in-ofbiz-tp4676594.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: Replace ftl with html in ofbiz

Julien NICOLAS
In reply to this post by hoboy2
Hi Jean-Luc,

What is really your need. We need the background of your think and
understand the reason of your question to find a way to help you.

For example, if you don't want to parse ftl file, you can use <#noparse>
</#noparse>

http://freemarker.incubator.apache.org/docs/ref_directive_noparse.html

Julien.

Le 28/01/2016 15:48, hoboy2 a écrit :

> Hi
>
> Ok I have partially asked this question before.
> I have looked into ofbiz doc I can not find an example
> of where to use html instead of ftl.
> I will like to use html instead of ftl
> any link ?
>
> Thanks
>
>
>
> --
> View this message in context: http://ofbiz.135035.n4.nabble.com/Replace-ftl-with-html-in-ofbiz-tp4676594.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: Replace ftl with html in ofbiz

Pierre Smits
Hi,

Incorporation of a html file in a screen, like in:
{code}


    <screen name="newcustomer">

        <section>

            <actions>

                <set field="titleProperty" value="PageTitleNewCustomer"/>

                <script location=
"component://myshop/src/org/apache/ofbiz/ecommerce/customer/NewCustomer.groovy"
/>


                <set field="dependentForm" value="newuserform"/>

                <set field="paramKey" value="countryGeoId"/>

                <set field="mainId" value="countryGeoId"/>

                <set field="dependentId" value="stateProvinceGeoId"/>

                <set field="requestName" value="getAssociatedStateList"/>

                <set field="responseName" value="stateList"/>

                <set field="dependentKeyName" value="geoId"/>

                <set field="descName" value="geoName"/>

                <set field="selectedDependentOption" default-value="_none_"
/>



            </actions>

            <widgets>

                <decorator-screen name="main-decorator" location=
"${parameters.mainDecoratorLocation}">

                    <decorator-section name="body">

                        <platform-specific>

                            <html>

                                <html-template location=
"component://common/webcommon/includes/setDependentDropdownValuesJs.ftl"/>

                                <html-template location=
"component://myshop/templates/customer/newcustomer.ftl"/>

                                *<html-template
location="component://myshop/templates/customer/newcustomer.html"/>*

                            </html>

                        </platform-specific>

                    </decorator-section>

                </decorator-screen>

            </widgets>

        </section>
{code}

renders the following result:
{code}
ERROR in error page, (infinite loop or error page not found with name
[/error/error.jsp]), but here is the text just in case it helps you:
org.ofbiz.widget.renderer.ScreenRenderException: Error rendering screen
[component://myshop/widget/CustomerScreens.xml#newcustomer]:
org.ofbiz.widget.renderer.ScreenRenderException: Error rendering screen
[component://myshop/widget/CommonScreens.xml#main-decorator]:
java.lang.IllegalArgumentException: Rendering not yet supported for the
template at location:
component://myshop/templates/customer/newcustomer.html (Rendering not yet
supported for the template at location:
component://myshop/templates/customer/newcustomer.html) (Error rendering
screen [component://myshop/widget/CommonScreens.xml#main-decorator]:
java.lang.IllegalArgumentException: Rendering not yet supported for the
template at location:
component://myshop/templates/customer/newcustomer.html (Rendering not yet
supported for the template at location:
component://myshop/templates/customer/newcustomer.html))
{code}

So, to answer your question completely: it is currently *not* supported.
Feel free to file a JIRA issue pertaining this matter.

Best regards,

Pierre Smits

ORRTIZ.COM <http://www.orrtiz.com>
OFBiz based solutions & services

OFBiz Extensions Marketplace
http://oem.ofbizci.net/oci-2/

On Thu, Jan 28, 2016 at 4:21 PM, Julien NICOLAS <[hidden email]>
wrote:

> Hi Jean-Luc,
>
> What is really your need. We need the background of your think and
> understand the reason of your question to find a way to help you.
>
> For example, if you don't want to parse ftl file, you can use <#noparse>
> </#noparse>
>
> http://freemarker.incubator.apache.org/docs/ref_directive_noparse.html
>
> Julien.
>
> Le 28/01/2016 15:48, hoboy2 a écrit :
>
>> Hi
>>
>> Ok I have partially asked this question before.
>> I have looked into ofbiz doc I can not find an example
>> of where to use html instead of ftl.
>> I will like to use html instead of ftl
>> any link ?
>>
>> Thanks
>>
>>
>>
>> --
>> View this message in context:
>> http://ofbiz.135035.n4.nabble.com/Replace-ftl-with-html-in-ofbiz-tp4676594.html
>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Replace ftl with html in ofbiz

Julien NICOLAS
Yes, but it could be interesting to understand the needs of Jean-Luc and
maybe the solution is in OFBiz and not in the new Jira creation
;)<http://www.centre-tic.com/>

Le 28/01/2016 16:29, Pierre Smits a écrit :
> Feel free to file a JIRA issue pertaining this matter.

Reply | Threaded
Open this post in threaded view
|

Re: Replace ftl with html in ofbiz

Julien NICOLAS
Sorry but this link is not... linked to this subject ;)

Le 28/01/2016 16:33, Julien NICOLAS a écrit :
> ...new Jira creation ;)<http://www.centre-tic.com/>

Reply | Threaded
Open this post in threaded view
|

Re: Replace ftl with html in ofbiz

Gil Portenseigne
In reply to this post by Gil Portenseigne
Indeed like Pierre shows, only *.ftl files are supported.

So depending on your need, you can use ftl files...

Gil

On 28/01/2016 16:20, gil portenseigne wrote:

                        <platform-specific>
                            <html><html-template location="component://mycomponent/path/to/my/index.html"/></html>
                        </platform-specific>

Reply | Threaded
Open this post in threaded view
|

Re: Replace ftl with html in ofbiz

Jacques Le Roux
Administrator
Le 28/01/2016 17:01, gil portenseigne a écrit :
> Indeed like Pierre shows, only *.ftl files are supported.

Simply rename the file extension from html to ftl, is that a big deal?

Jacques

>
> So depending on your need, you can use ftl files...
>
> Gil
>
> On 28/01/2016 16:20, gil portenseigne wrote:
>>
>>                         <platform-specific>
>>                             <html><html-template location="component://mycomponent/path/to/my/index.html"/></html>
>>                         </platform-specific>
>

Reply | Threaded
Open this post in threaded view
|

Re: Replace ftl with html in ofbiz

hoboy1
This post was updated on .
In reply to this post by hoboy2
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Replace ftl with html in ofbiz

hoboy2
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Replace ftl with html in ofbiz

taher
Hi,

Your question is not very clear to me. why do you want to replace ftl with
jsp or html. Freemarker is just a templating engine like many others that
exist out there including jsp. You do not replace free marker with HTML you
just remove any freemarker tags (i.e. anything that starts with <#...> and
you've got HTML. However you lose the ability to code variables into your
HTML which is the main purpose why a templating language exists.

Perhaps if you clarify exactly what you want with an example then we can
help more

Taher Alkhateeb

On Friday, 29 January 2016, hoboy2 <[hidden email]> wrote:

> Thanks guys.
> I will like to add little more to what my colleague has written.
> The issue is that we will like to create new screen on the current running
> ofbiz application, we will like to reused the services we have witch are
> groovy and java.
> For the  new screen we will like to use html instead of ftl.
> Can jsp or something else be used ?
>
> Example:
>
> bellow is a portion of fetch_category_sector.ftl.
>
> ------------------------------------------------------------------------------------------------------
> fetch_category_sector.ftl
>
> <div class="${request.getAttribute("attributeClass")!}<#if className?exists
> && className?has_content> ${className}</#if>">
>   <div class="displayBox">
>
> Category Selection
>
>     <form method="post">
>     <div id="alllists">
>       <#list allCategories as cat>
>       <div id="${cat.categoryName}">
>         <button class=&quot;selected&quot;
> formaction=&quot;&lt;@ofbizUrl>main</@ofbizUrl>"
> type="submit">${cat.categoryName}</button>
>         <#list allSectors as sec>
>           <#if sec.primaryParentOrgCategoryId ==
> cat.organizationCategoryId>
>             <a formaction=&quot;&lt;@ofbizUrl>main</@ofbizUrl>"
> type="submit">${sec.sectorName}
>           </#if>
>         </#list>
>         </div>
>       </#list>
>     </div>
>     </form>n
>   </div>
> </div>
>
> -------------------------------------------------------------------------------------
> The screen
>
>  <screen name="testscreen">
>         <section>
>             <actions>
>                 <set field="pageClassIdentifier" value="testscreen" />
>                 <property-map resource="OSafeUiLabels"
> map-name="uiLabelMap"
> global="true" />
>                 <set field="pageTitle" value="A Test Screen" />
>                 <set field="title" from-field="pageTitle" />
>                 <set field="fieldLevelErrors"
> value="${groovy:if(request.getAttribute('setFieldLevelErrors') ==
> 'N')return
> '' else return 'Y';}" />
>                 <script
>
> location="component://osafe/webapp/osafe/WEB-INF/actions/custom/fetch_category_sector.groovy"
> />
>             </actions>
>             <widgets>
>                 <decorator-screen
> name="${parameters.eCommerceDecoratorName}"
> location="${parameters.eCommerceDecoratorLocation}">
>                     <decorator-section name="title">
>                         <include-screen name="pageTitle"
> location="component://osafe/widget/EcommerceScreens.xml"/>
>                     </decorator-section>
>                     <decorator-section name="body">
>                         <section>
>                             <widgets>
>                                 <platform-specific>
>                                     <html>
>                                         <html-template
>
> location="component://osafe/webapp/osafe/common/entry/custom/fetch_category_sector.ftl"/>
>                                     </html>
>                                 </platform-specific>
>                             </widgets>
>                         </section>
>                     </decorator-section>
>                 </decorator-screen>
>             </widgets>
>         </section>
>     </screen>
>
> -------------------------------------------------------------------------------------------------
>
> The question is can I code fetch_category_sector.ftl in html ?
> and use it in the testscreen ?
>
> Thanks
>
>
>
>
> --
> View this message in context:
> http://ofbiz.135035.n4.nabble.com/Replace-ftl-with-html-in-ofbiz-tp4676594p4676620.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: Replace ftl with html in ofbiz

hoboy2
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Replace ftl with html in ofbiz

Nicolas Malin-2
Hoboy2,

re read the thread, all people said, you can write your html file as
html file and name it .ftl insteadof .html

Nicolas

Le 29/01/2016 08:44, hoboy2 a écrit :

> Thanks Taher
>
> We have to create severals new screens for our currents application,
> normally one will just used ftl.
> But the person responsible for ui implementation have told us that they can
> not do this using ftl.
> they are familiar with jquery, javaScript, html.
> So I am trying to find out how to use that ui in ofbiz.
>
>
>
>
> --
> View this message in context: http://ofbiz.135035.n4.nabble.com/Replace-ftl-with-html-in-ofbiz-tp4676594p4676623.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: Replace ftl with html in ofbiz

Julien NICOLAS
In reply to this post by hoboy2
Ok, so I understand.

Just let them create pages with html and just put them in ftl.
You can use the html in the ftl but the power is, if you need something
available in OFBiz in your html, you can call it from the ftl \o/

If you want to include javascript or jquery files just do it like that
in the screen :

     <screen name="HIBOrderAlertInformation">
         <section>
             <actions>
                 <set field="tabButtonItem"
value="HIBOrderAlertInformation"/>
                 <set field="layoutSettings.javaScripts[]"
value="/myapp/images/js/myapp-uxscreens.js" global="true" />

                 <script
location="component://myapp/webapp/myapp/WEB-INF/actions/custRequest/CustRequestScreenUX.groovy"/>
             </actions>
             <widgets>
                 <decorator-screen name="MyDecorator">
                     <decorator-section name="body">
                         <section>
                             <widgets>
<platform-specific><html><html-template
location="component://myapp/templates/uxScreens/orderAlert.ftl"/></html></platform-specific>
                             </widgets>
                         </section>
                     </decorator-section>
                 </decorator-screen>
             </widgets>
         </section>
     </screen>


Le 29/01/2016 08:44, hoboy2 a écrit :
> they are familiar with jquery, javaScript, html.

Reply | Threaded
Open this post in threaded view
|

Replace ftl with html in ofbiz

taher
In reply to this post by Nicolas Malin-2
Hi,

You cannot create any dynamic application that talks to your database or
interacts with external systems using pure html, css and Javascript. You
need a templating engine. With that being said you only need to teach your
developer minimal ftl. you just give him/her a list of your defined
variables for each screen and they use it with a simple ${varNameHere} and
sometimes if it is a list of things you use a <#list ...> syntax which is
very simple to learn. That's pretty much all they need to learn to start
using ftl. The rest is all css, html and JavaScript.

Taher Alkhateeb

On Friday, 29 January 2016, hoboy2 <[hidden email]
<javascript:_e(%7B%7D,'cvml','[hidden email]');>> wrote:

> Thanks Taher
>
> We have to create severals new screens for our currents application,
> normally one will just used ftl.
> But the person responsible for ui implementation have told us that they can
> not do this using ftl.
> they are familiar with jquery, javaScript, html.
> So I am trying to find out how to use that ui in ofbiz.
>
>
>
>
> --
> View this message in context:
> http://ofbiz.135035.n4.nabble.com/Replace-ftl-with-html-in-ofbiz-tp4676594p4676623.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: Replace ftl with html in ofbiz

hoboy2
In reply to this post by Julien NICOLAS
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Replace ftl with html in ofbiz

Julien NICOLAS
Jean-Luc,

I think you must take a look at what Taher said :

  With that being said you only need to teach your
developer minimal ftl.

He is right, your developpers need to know minimal ftl functions. It's
not a big deal and with javascript and JQuery, it's powerful in OFBiz !

Julien.

Le 29/01/2016 08:55, hoboy2 a écrit :

> Julien NICOLAS
>
> Thanks very much you have answered to my question
> Thanks to everybody who have used time and effort to help.
>
>
>
> --
> View this message in context: http://ofbiz.135035.n4.nabble.com/Replace-ftl-with-html-in-ofbiz-tp4676594p4676627.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: Replace ftl with html in ofbiz

hoboy2
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Replace ftl with html in ofbiz

Nicolas Malin-2
Damned, the sentence "make life simple" it's difficult to apply some
time. And some time is all the time :)

Nicolas

Le 29/01/2016 09:09, hoboy2 a écrit :

> Taher and Julien NICOLAS.
>
> Thanks for the advices.
>   it is a task outsourced to a different company.
>
> Thanks
>
>
>
> --
> View this message in context: http://ofbiz.135035.n4.nabble.com/Replace-ftl-with-html-in-ofbiz-tp4676594p4676629.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.

12