Zope3 Develop new Skin

Source: Internet
Author: User
Keywords We nbsp;
Tags application browser configuration configure content create default developing

Until now we are only improving the performance of the message board, and the user interface has not done much to improve. In fact, we have been using ZMI for all the message management, which is completely unsuitable for the end user. So this chapter will focus on developing a skin to implement the user interface for the message board, as we have seen in the reality of the message-thin application. While the package requires a bit of Python development, I think it's a good task for our two content component parts.

The skin (equivalent to the CMF in Zope 2) is a way to implement a custom interface to an existing view. This is very similar to HTML and CSS (hierarchical style sheets), and for HTML code Views (page templates, view classes) and style sheets (CSS) are equivalent to the skin on HTML structure elements. Under the skin there is however another abstraction layer.

The skin is actually a stack of layers. Each layer contains views and resources. This allows specific views and resources to be invalidated. For example, our stylesheet (CSS) may be defined on the default layer. However, the stylesheet is too simple and inappropriate for our needs. So we can create a new layer board and put a new style sheet there. When finished, we define a skin that is board layer after the default layer, and all new style definitions take effect.

Step I: Prepare

Before we create new skins, we need to be prepared. To confuse the original view and resource, we create a package named skin in the Messageboard/browser directory, and don't forget to generate the ' init.py ' file. Then create an empty CONFIGURE.ZCML file:

1&http://www.aliyun.com/zixun/aggregation/37954.html ">NBSP; <configure
2 xmlns= "Http://namespaces.zope.org/browser" >
3
4 </configure>

Now import the configuration into the browser's CONFIGURE.ZCML with the following statement:

1 <include package= ". Skin"/>

Step II: Create a new skin

Creating a new skin is very easy, with ZCML configuration statements can be fully implemented. The browser namespace has a name skin statement that allows us to complete, so add the following statement to the skin package configuration file:

1 <layer name= "board"/>
2
3 <skin name= "board" layers= "board Rotterdam Default"/>

The first statement creates a new layer where we will put all the new templates and produce a unique skin. The second statement creates a skin called board, consisting of three layer stacks of elements. The bottom layer is the default layer, covered by Rotterdam, and it is covered by board.

You may wonder why the Rotterdam layer will be here. The Rotterdam layer contains some better definitions, such as favicon and other view codes that are useful to us. Besides, we don't use this layer very often.

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.