本站首页    管理页面    写新日志    退出


«September 2025»
123456
78910111213
14151617181920
21222324252627
282930


公告
 本博客在此声明所有文章均为转摘,只做资料收集使用。

我的分类(专题)

日志更新

最新评论

留言板

链接

Blog信息
blog名称:
日志总数:1304
评论数量:2242
留言数量:5
访问次数:7603507
建立时间:2006年5月29日




[Java Open Source]Liferay Portal学习笔记之(五):开发主题风格theme
软件技术

lhwork 发表于 2006/9/5 9:56:14

Liferay Portal为我们提供了非常灵活的主题风格定制功能,自身带了四种风格的theme,在官方网站上提供了很多风格theme的下载,这无疑大大增强了主 题风格定制的功能。但是,我们完全可以开发具有自己风格的theme,这里,我们将讨论怎样来开发个性的theme。第一步:我们将以现有风格classic为模板文件创建新的theme,我们将新theme命名为coldtear1、将liferay/html/themes目录下的classic文件夹copy一份副本,并修改副本的文件夹名为coldtea2、 在liferay/web-inf目录下新建liferay-look-and-feel-ext.xml文件,文件liferay-look-and- feel.xml是定义主题风格theme的配置文件,为了加以区分,我们在这里新建了该文件的扩展文件liferay-look-and-feel- ext.xml,该文件内容如下:500)this.width=500'><?xml version="1.0"?>500)this.width=500'><!DOCTYPE look-and-feel PUBLIC "-//Liferay//DTD Look and Feel 4.0.0//EN" "http://www.liferay.com/dtd/liferay-look-and-feel_4_0_0.dtd">500)this.width=500'>500)this.width=500'><look-and-feel>500)this.width=500'>    <compatibility>500)this.width=500'>        <version>4.0.0</version>500)this.width=500'>    </compatibility>500)this.width=500'>    <company-limit>500)this.width=500'>        <company-includes />500)this.width=500'>        <company-excludes />500)this.width=500'>    </company-limit>500)this.width=500'>    <theme id="coldtear" name="ColdTear">500)this.width=500'>        <root-path>/html/themes/coldtear</root-path>500)this.width=500'>        <templates-path>/html/themes/coldtear/templates</templates-path>500)this.width=500'>        <images-path>/html/themes/coldtear/images</images-path>500)this.width=500'>        <template-extension>jsp</template-extension>500)this.width=500'>        <color-scheme id="01" name="Blue">500)this.width=500'>            <![CDATA[500)this.width=500'>                body-bg=#FFFFFF500)this.width=500'>                500)this.width=500'>                layout-bg=#FFFFFF500)this.width=500'>                layout-text=#000000500)this.width=500'>500)this.width=500'>                layout-tab-bg=#E0E0E0500)this.width=500'>                layout-tab-text=#000000500)this.width=500'>500)this.width=500'>                layout-tab-selected-bg=#6699CC500)this.width=500'>                layout-tab-selected-text=#4A517D500)this.width=500'>500)this.width=500'>                portlet-title-bg=#6699CC500)this.width=500'>                portlet-title-text=#4A517D500)this.width=500'>500)this.width=500'>                portlet-menu-bg=#B6CBEB500)this.width=500'>                portlet-menu-text=#000000500)this.width=500'>500)this.width=500'>                portlet-bg=#FFFFFF500)this.width=500'>500)this.width=500'>                portlet-font=#000000500)this.width=500'>                portlet-font-dim=#C4C4C4500)this.width=500'>500)this.width=500'>                portlet-msg-status=#000000500)this.width=500'>                portlet-msg-info=#000000500)this.width=500'>                portlet-msg-error=#FF0000500)this.width=500'>                portlet-msg-alert=#FF0000500)this.width=500'>                portlet-msg-success=#007F00500)this.width=500'>500)this.width=500'>                portlet-section-header=#094170500)this.width=500'>                portlet-section-header-bg=#ADBDFB500)this.width=500'>500)this.width=500'>                portlet-section-subheader=#405278500)this.width=500'>                portlet-section-subheader-bg=#91AEE8500)this.width=500'>500)this.width=500'>                portlet-section-body=#000000500)this.width=500'>                portlet-section-body-bg=#E2E7FA500)this.width=500'>500)this.width=500'>                portlet-section-body-hover=#FFFFFF500)this.width=500'>                portlet-section-body-hover-bg=#AC6CFA500)this.width=500'>500)this.width=500'>                portlet-section-alternate=#000000500)this.width=500'>                portlet-section-alternate-bg=#CFD7FB500)this.width=500'>500)this.width=500'>                portlet-section-alternate-hover=#FFFFFF500)this.width=500'>                portlet-section-alternate-hover-bg=#AC6CFA500)this.width=500'>500)this.width=500'>                portlet-section-selected=#7AA0EC500)this.width=500'>                portlet-section-selected-bg=#FAFCFE500)this.width=500'>500)this.width=500'>                portlet-section-selected-hover=#00329A500)this.width=500'>                portlet-section-selected-hover-bg=#C0D2F7500)this.width=500'>            ]]>500)this.width=500'>        </color-scheme>500)this.width=500'>    </theme>500)this.width=500'></look-and-feel>这里,注意的是修改theme的id和name,以及root-path、templates-path和images-path的路径,这样,我们就可以在主题风格页面看到我们新的theme了。第二步、分析classic的主题布局的划分1、 打开liferay/html/theme/coldtear/templates目录,该目录下存放着很多jsp文件,打开 portal_normal.jsp文件可以看到,该文件是整个页面的主体,通过<liferay-util:include />标签和<%@ include>方法包含了很多jsp文件,其中top.jsp文件定义了头部信息,navigation.jsp定义了导航菜单, bottom.jsp定义了底部语言标签信息,而页面的主体信息是由<liferay-theme:box />标签定义的,top="portlet_top.jsp"定义了portlet的标题栏信息,bottom= "portlet_bottom.jsp"定义了portlet下面的阴影线,portlet的内容则是由<liferay-util: include page="<%= Constants.TEXT_HTML_DIR + tilesContent %>" />定义的。所有的css样式信息是定义在css_cached.jsp文件中的。2、liferay portal的页面定义大部分地方都采用了DIV+CSS的方式,下面将以classic的整个DIV定义框架给出,以说明classic风格的定义方法。500)this.width=500'><div id="layout-outer-side-decoration">500)this.width=500'><div id="layout-inner-side-decoration">500)this.width=500'><div id="layout-box">500)this.width=500'>    <!-- 定义头部信息 top.jsp -->500)this.width=500'>    <div id="layout-top-banner">500)this.width=500'>        <div id="layout-user-menu" style="text-align: right;">500)this.width=500'>            <div class="font-small" style="margin-top: 5px;">500)this.width=500'>                <div id="layout-my-places">500)this.width=500'>                    <div id="p_p_id_49_" class="portlet-boundary">500)this.width=500'>                        <div class="portlet-borderless-container">500)this.width=500'>                        </div>500)this.width=500'>                    </div>500)this.width=500'>                </div>500)this.width=500'>            </div>500)this.width=500'>        </div>500)this.width=500'>    </div>500)this.width=500'>    <!-- 定义导航菜单 navigation.jsp -->500)this.width=500'>    <div id="layout-nav-container">500)this.width=500'>        <div class="layout-nav-tabs-box">500)this.width=500'>            <div class="layout-tab"></div>500)this.width=500'>            <div class="layout-tab"></div>500)this.width=500'>            <div class="layout-tab-selected"></div>500)this.width=500'>            <div class="layout-tab"></div>500)this.width=500'>        </div>500)this.width=500'>        <div id="layout-global-search"></div>500)this.width=500'>    </div>500)this.width=500'>    <div class="portlet-bottom-decoration-2"><div><div></div></div></div>500)this.width=500'>    <!-- 定义主体portlet信息部分  -->500)this.width=500'>    <div id="layout-content-outer-decoration">500)this.width=500'>        <div id="layout-content-inner-decoration">500)this.width=500'>            <div id="layout-content-container">500)this.width=500'>                <div id="layout-column_column-1">500)this.width=500'>                    <div id="p_p_id_73_INSTANCE_9Q28_" class="portlet-boundary">500)this.width=500'>                        <div class="portlet-container">500)this.width=500'>                            <!-- 定义portlet标题栏信息 portlet-top.jsp -->500)this.width=500'>                            <div class="portlet-header-bar" id="portlet-header-bar_73_INSTANCE_9Q28" onmouseover="PortletHeaderBar.show(this.id)" onmouseout="PortletHeaderBar.hide(this.id)">500)this.width=500'>                                <div class="portlet-wrap-title">500)this.width=500'>                                </div>500)this.width=500'>                                <div class="portlet-small-icon-bar" style="display: none;">500)this.width=500'>                                </div>500)this.width=500'>                            </div>500)this.width=500'>                            <!-- 定义portlet内容信息  -->500)this.width=500'>                            <div class="portlet-box">500)this.width=500'>                                <div class="portlet-minimum-height">500)this.width=500'>                                    <div id="p_p_body_73_INSTANCE_9Q28" >500)this.width=500'>                                        <div class="slide-maximize-reference">500)this.width=500'>                                            <div id="p_p_content_73_INSTANCE_9Q28_" style="margin-top: 0; margin-bottom: 0;">500)this.width=500'>                                            </div>500)this.width=500'>                                        </div><!-- slide-maximize-reference -->500)this.width=500'>                                    </div>500)this.width=500'>                                </div>500)this.width=500'>                            </div><!-- end portlet-box -->500)this.width=500'>                            <!-- 定义portlet底部阴影线 portlet-bottom.jsp -->500)this.width=500'>                            <div class="portlet-bottom-decoration-2"><div><div></div></div></div>500)this.width=500'>                        </div><!-- End portlet-container -->500)this.width=500'>                    </div>500)this.width=500'>                    <!-- 定义一个空的portlet区域 -->500)this.width=500'>                    <div class="layout-blank-portlet"></div>500)this.width=500'>                </div>500)this.width=500'>            </div>500)this.width=500'>        </div>500)this.width=500'>    </div>500)this.width=500'>    <!-- 定义底部信息 bottom.jsp -->500)this.width=500'>    <div id="layout-bottom-container"></div>500)this.width=500'></div><!-- End layout-box -->500)this.width=500'></div>500)this.width=500'></div><!-- End layout-outer-side-decoration -->500)this.width=500'>这里我们可以看到classic的整体DIV定义框架,注释部分对每个部分的定义都做了区分。第三步、根据这样一个结构,我们可以设计自定义theme风格的结构,然后将各个区域细化到各个jsp文件中,并配以特定的图片和样式就可以实现自定义theme,为了达到更好的显示效果,需要教好的掌握CSS的各个属性和使用方法。


阅读全文(3594) | 回复(0) | 编辑 | 精华
 



发表评论:
昵称:
密码:
主页:
标题:
验证码:  (不区分大小写,请仔细填写,输错需重写评论内容!)



站点首页 | 联系我们 | 博客注册 | 博客登陆

Sponsored By W3CHINA
W3CHINA Blog 0.8 Processed in 0.063 second(s), page refreshed 144764622 times.
《全国人大常委会关于维护互联网安全的决定》  《计算机信息网络国际联网安全保护管理办法》
苏ICP备05006046号