Transfer OFBiz website or shop visual theme Design

Source: Internet
Author: User

What why

V. The topic of the application in OFBiz can be configured through data. In the catalog and content menus of the WebTools component, the topic of the store and website can be set separately. When designing front-end pages, OFBiz uses a large number of DIV elements instead of HTML elements such as tables for layout. In this way, you can set different visual styles for a website or store. At the same time, the content and style in HTML are separated to improve development efficiency and maintainability.

How

V. In the ecommerce example in OFBiz, the website subject is obtained based on the service in an action. This service is implemented in the mini language.

commonscreens under ecommerce. in XML # Main-decorator action, the Service tag is used to call services implemented in mini language.

<SCRIPT location = "component: // ecommerce/widget/ecommercesetup. Groovy"/> <! -- Get the store visualtheme --> <set field = "visualthemeid" from-field = "productstore. visualthemeid "default-value =" ec_default "/> <span style =" color: # ff0000 "> <Service-name =" getvisualthemeresources "> </span> <field-map field-name =" visualthemeid "/> <field-map field-name =" themeresources "from-field =" layoutsettings "/> </service> <set field =" layoutsettings "from-field =" themeresources "default-Val UE = "$ {layoutsettings}" Global = "true"/> <set field = "headertemplatelocation" from-field = "layoutsettings. vt_hdr_tmplt_loc [0] "default-value =" component: // ecommerce/webapp/eCommerce/uplodes/header. FTL "/> <set field =" footertemplatelocation "from-field =" layoutsettings. vt_ftr_tmplt_loc [0] "default-value =" component: // ecommerce/webapp/eCommerce/shortdes/footer. FTL "/> <SCRIPT location =" component: // ecommerce /Widget/ecommercesetup. Groovy "/> <! -- Get the store visualtheme --> <set field = "visualthemeid" from-field = "productstore. visualthemeid "default-value =" ec_default "/> <Service-name =" getvisualthemeresources "> <field-map field-name =" visualthemeid "/> <field-map field- name = "themeresources" from-field = "layoutsettings"/> </service> <set field = "layoutsettings" from-field = "themeresources" default-value = "$ {layoutsettings} "Global =" true "/> <set field =" headertemplatelocation "from-field =" layoutsettings. vt_hdr_tmplt_loc [0] "default-value =" component: // ecommerce/webapp/eCommerce/uplodes/header. FTL "/> <set field =" footertemplatelocation "from-field =" layoutsettings. vt_ftr_tmplt_loc [0] "default-value =" component: // ecommerce/webapp/eCommerce/shortdes/footer. FTL "/>

Services implemented in the mini language are in OFBiz \ framework \ common \ Script \ org \ OFBiz \ common \ commonservices. xml.

<Simple-method-name = "<span style =" color: # ff6600 "> getvisualthemeresources </span>" short-description = "get visual theme resources" login-required = "false"> <set field = "visualthemeid" from-field =" parameters. visualthemeid "/> <set field =" themeresources "from-field =" parameters. themeresources "/> <entity-condition list =" resourcelist "entity-name =" visualthemeresource "use-Cache =" true "> <condition-expr Field-name = "visualthemeid" from-field = "visualthemeid"/> <order-by field-name = "resourcetypeenumid"/> <order-by field-name = "sequenceid" /> </entity-condition> <if-empty field = "resourcelist"> <! -- If not found use the good old initial OFBiz theme so the system will at least start up and will be usable --> <Log Level = "error" message = "cocould not find' $ {visualthemeid} 'Theme, reverting back to the good old OFBiz theme... "> </log> <entity-condition list =" resourcelist "entity-name =" visualthemeresource "use-Cache =" true "> <condition-expr field-name =" visualthemeid "value =" flat_grey "/> <order-by field-name =" resourcetypeenumid "/> <order-by field-name =" sequenceid "/> </entity-condition> </if-empty> <if-empty field = "resourcelist"> <add-error> <fail-Property = "commonvisualthemeresourcesnotfound" resource = "commonuilabels"/> </Add -Error> <check-errors/> </if-empty> <iterate list = "resourcelist" entry = "resourcerecord"> <set field = "resourcetypeenumid" from-field =" resourcerecord. resourcetypeenumid "/> <set field =" resourcevalue "from-field =" resourcerecord. resourcevalue "/> <if-empty field =" resourcevalue "> <property-to-field =" warningmsg "property =" commonvisualthemeinvalidrecord "resource =" commonuilabels "/> <Log Level = "warning" message = "$ {warningmsg}"/> <else> <set field = "themeresources [resourcetypeenumid] []" from-field = "resourcevalue"/> </ else> </if-empty> </iterate> <field-to-result field = "themeresources"/> </simple-method>

favorite for future reference, reproduced from: http://blog.csdn.net/kl323/article/details/7365521

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.