【原创】Liferay Portal学习笔记(三):自定义页面布局Template
来源:百度文库 编辑:神马文学网 时间:2024/04/29 23:03:07
我们将开发一个具有下图风格的页面布局,该布局中我们指定了7个区域来分别装配portlet实现独特的页面风格。
一、编写模板文件
我们将该页面风格名称定义为1_2_3_2 Columns,在Liferay/html/layouttpl/custom目录下新建1_2_3_2_columns.tpl文件,内容如下:
$processor.processColumn("column-1") | |||||||
| $processor.processColumn("column-5") | ||||||
|
文件中前三行定义的
二、编写属性文件
我们需要在 liferay-layout-templates.xml 文件中配置我们自定义的页面布局文件 1_2_3_2_columns.tpl ,为了和系统自带的布局文件区分开,我们创建扩展文件 liferay-layout-templates-ext.xml ,在该文件中指定我们的页面布局文件,当然也可以在 liferay-layout-templates.xml 文件直接增加定义。
liferay-layout-templates-ext.xml :
xml version = " 1.0 " ?>
< layout - templates >
< custom >
< layout - template id = " 1_2_3_2_columns " name = " 1-2-3-2 Columns " >
< template - path >/ html / layouttpl / custom / 1_2_3_2_columns.tpl template - path >
layout - template >
custom >
layout - templates >
参数 id 定义该 template 的 ID 号, name 定义该 template 在 Add Content 中显示的名称, template-path 定义该 template 的路径名。
三、定制页面
定制好页面风格后,需要重新启动TOMCAT,登陆系统,进入GUEST频道,点击Add Content ,在Template中将会显示我们自定义的页面布局名称