在 上一篇博文中,提到了怎麼創作 theme ,其實那只是一個殼。
現在纔是編輯。
先解釋下它裏面的 各種文件 的含義。
--------------------------------------
門戶支持兩種形式的風格開發,一種是直接做風格文件夾放入工程中,另一種是將風格做爲一個應用與門戶並行存在。在此我們只說明文件夾形式的風格製作。
目錄分析:
風格包都放在/html/themes/ 下
主題目錄:
css:該主題的樣式文件
images:主題的圖片文件
javascript:主題所需的javascript文件
templates:主題的velocity模版文件
主題樣式文件
main.css:主樣式文件
base.css:基礎樣式
custom.css:個性化樣式
form.css:portlet中form樣式
layout.css:佈局樣式
navigation.css:導航樣式
portlet.css:portlet樣式
tabs.css:表格樣式
注:主題的樣式要寫在對應的樣式文件裏,這樣維護方便。
主題圖片:
注:主題的圖片要放在對應的文件裏,這樣維護方便。
主題模版文件:
模版初始化在/html/themes/_unstyled/templates/init.vm
portal_normal.vm:是整體portal模板
它包括了:
--banner部分
--logo徽標
--dock管理工具
--navigation導航部分
--Portlet容器部分
--bottom部分
navigation.vm:導航模板
--當前portal的子頁或子portal
--我的空間(當前用戶能訪問的空間或工作區)
dock.vm:管理工具模板
--首頁
--我的賬戶
--登出
--登入
--添加內容
--風格
--頁面設置
portlet.vm:portlet模版
--top
--body
--bottom
結合上一篇博文,修改完畢,改好相應的look-and-feel.xml 文件,就可以直接 install 進去。
(注:不能自己壓縮成 *.zip 或 *.war 文件,那是沒有經過 ant編譯的,導入去是錯誤的。)
-----------------------------------------------
另外方法:
製作流程:
A- 可以直接在 D:/gavin.wang/Java/jar/Liferay/liferay-portal-5.2.3/tomcat-6.0.18/webapps/JEDI
JEDI爲theme 的顯示名稱(也就文件夾名),可以直接在該文件夾下的子文件夾中,修改各個CSS和VM文件等。
-------------------
B- 如下:
第一步:在/webapps/ROOT/html/themes拷貝一個已存在的風格文件改名爲你的風格名:
第二步:在/WEB-INF/liferay-look-and-feel.xml文件<custom></custom>元素間增加如下代碼:
<theme id="文件夾名" name="自定義">
<root-path>/html/themes/${theme-id}</root-path>
<settings>
<setting key="bullet-style-options" value="1,2" />
</settings>
</theme>
第三步
在/html/themes/genesis/images/
添加該風格的效果圖,命名爲thumbnail.png
第四步重啓服務
注:默認LOGO
/com/liferay/portal/dependencies中圖片company_logo.png
製作一個佈局
例如:我們要在portal裏添加一個佈局:
製作開始
第一步:創建佈局模版文件
/layouttpl/custom/下添加三個文件:
2_3_columns.tpl web佈局模版文件
2_3_columns.wap.tpl wap佈局模版文件(不支持wap可以不添加)
2_3_columns.gif 佈局模版效果圖
2_3_columns.tpl內容如下:(css樣式在/html/themes/風格包/css/layout.css中定義)
<div class="columns-2-3" id="content-wrapper">
<table id="layout-grid">
<tr>
<td class="lfr-column twentyfive" id="column-1" valign="top">
$processor.processColumn("column-1")
</td>
<td class="lfr-column seventyfive" id="column-2" colSpan="3" valign="top">
$processor.processColumn("column-2")
</td>
</tr>
<tr>
<td class="lfr-column twentyfive" id="column-3" valign="top">
$processor.processColumn("column-3")
</td>
<td class="lfr-column fifty" id="column-4" colSpan="2" valign="top">
$processor.processColumn("column-4")
</td>
<td class="lfr-column twentyfive" id="column-5" valign="top">
$processor.processColumn("column-5")
</td>
</tr>
</table>
</div>
第二步:將做好的佈局模版文件加入配置文件中
/WEB-INFO/liferay-layout-templates-ext.xml
參數 id 定義該 template 的 ID 號, name 定義該 template 在 Add Content 中顯示的名稱, template-path 定義該 template 的路徑名。
製作完畢