日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

Liferay Portal學習筆記(二):使用CMS

系統(tǒng) 1734 0
?????? Liferay Portal CMS(Content Manage System) 提供了兩大功能:文檔管理和文章發(fā)布。文檔管理包括文檔庫和圖片集兩個 portlets ,能夠提供對 Microsoft Office 文檔、 PDFs 、文本文件和圖片的管理;文章發(fā)布功能依靠 Liferay Portal 中的 Journal portlet 完成,它的特性是能夠?qū)?shù)據(jù)( data entry )和版面設計( Layout Design )很輕易的分開,這就使得 content 能夠復合一致的“ look and feel ”,另外, Journal portlet 提供了 content 的版本跟蹤和發(fā)布流程的功能。
???

Liferay Portal CMS 功能是通過 Journal Portlet 實現(xiàn)的,在介紹怎樣使用 Journal Portlet 之前,有必要理解 structures templates articles 的概念,它們是 Journal portlet 功能的基礎。

l ???????? Structures :定于了 content 的類型和數(shù)量, content 的類型包括 text text area images selection lists

l ???????? Templates :確定 content 怎樣排列或擺放

l ???????? Articles :確定每個 content 包含的實際的 text images

??
??? 我們以下圖為例定義一個
content ,分為三個步驟:
1.JPG

第一步、創(chuàng)建 Structure ,包含一下元素:一個 text 元素名為“ headline ”(對應圖片 1 區(qū)域)、三個 text area 元素為名稱分別為“ body-text ”(對應 4 區(qū)域)“ caption-1 ”(對應 2 區(qū)域)“ caption-2 ”(對應 6 區(qū)域)、兩個 image 元素名稱分別為“ image-1 ”(對應 3 區(qū)域)和“ image-2 ”(對應 5 區(qū)域)

添加完這些元素后的界面如下:
2.JPG

點擊 Launch Editor 按鈕,可以看到 XML 定義,也可以在此增刪或修改元素及類型,內(nèi)容如下:

< root >
??
< dynamic - element?name = ' headline ' ?type = ' text ' ><!----> dynamic - element >
??
< dynamic - element?name = ' body-text ' ?type = ' text_area ' ><!----> dynamic - element >
??
< dynamic - element?name = ' caption-1 ' ?type = ' text_area ' ><!----> dynamic - element >
??
< dynamic - element?name = ' caption-2 ' ?type = ' text_area ' ><!----> dynamic - element >
??
< dynamic - element?name = ' image-1 ' ?type = ' image ' ><!----> dynamic - element >
??
< dynamic - element?name = ' image-2 ' ?type = ' image ' ><!----> dynamic - element >
<!----> root >

第二步、創(chuàng)建 Template ,添入 ID Name Description 信息后,在 Structure 一欄選擇上一步創(chuàng)建的 Structure (這里為 test
3.JPG

然后點擊 Launch Editor 按鈕,打開 Template 編輯窗口,按照所需要的格式定義 Template ,如下:

xml?version = " 1.0 " ?>

< xsl:stylesheet?xmlns:xsl = " http://www.w3.org/1999/XSL/Transform " ?version = " 1.0 " > ??
??
< xsl:output?method = " html " ?omit - xml - declaration = " yes " /> ??
??
< xsl:template?match = " / " > ?
????
< table?cellpadding = " 0 " ?cellspacing = " 0 " ?border = " 0 " ?width = " 100% " > ?
??????
< tr > ?
????????
< td?colspan = " 2 " >
??????????
< xsl:value - of
?disable
- output - escaping = " yes " ?select = " root/dynamic-element[@name='headline']/dynamic-content " />
????????
<!----> td >
??????
<!----> tr >
??????
< tr >
????????
< td >
??????????
< img > ?
????????????
< xsl:attribute?name = " src " > ?
??????????????
< xsl:value - of?
disable
- output - escaping = " yes " ?select = " root/dynamic-element[@name='image-1']/dynamic-content " /> ?
????????????
<!----> xsl:attribute > ?
??????????
<!----> img >
????????
<!----> td >
????????
< td >
??????????
< xsl:value - of?
disable
- output - escaping = " yes " ?select = " root/dynamic-element[@name='caption-1']/dynamic-content " />
????????
<!----> td >
??????
<!----> tr >
??????
< tr >
????????
< td?colspan = " 2 " >
??????????
< xsl:value - of?
disable
- output - escaping = " yes " ?select = " root/dynamic-element[@name='body-text']/dynamic-content " />
????????
<!----> td >
??????
<!----> tr >
??????
< tr >
????????
< td >
??????????
< xsl:value - of?
disable
- output - escaping = " yes " ?select = " root/dynamic-element[@name='caption-2']/dynamic-content " />
????????
<!----> td >
????????
< td >
??????????
< img > ?
????????????
< xsl:attribute?name = " src " > ?
??????????????
< xsl:value - of?
disable
- output - escaping = " yes " ?select = " root/dynamic-element[@name='image-2']/dynamic-content " /> ?
????????????
<!----> xsl:attribute > ?
??????????
<!----> img >
????????
<!----> td >
??????
<!----> tr >
????
<!----> table > ?
??
<!----> xsl:template > ?
<!----> xsl:stylesheet >

下面對該文件進行說明:

1 、這里的 @name=’ 名稱 必須要和第一步中創(chuàng)建 Structure 中的元素名稱一致,頁面格式根據(jù)需求使用 HTML 語言定義即可。

2 、對 text text area 類型的元素輸出時的格式如下:

<xsl:value-of></xsl:value-of>

disable-output-escaping="yes" select="root/dynamic-element[@name='caption-2']/dynamic-content"/>

1、 ? image 類型的元素輸出時的格式如下:

? <xsl:attribute name="src"> </xsl:attribute>

??? <xsl:value-of></xsl:value-of>

disable-output-escaping="yes" select="root/dynamic-element[@name='image-2']/dynamic-content"/>

?

第三步、創(chuàng)建 Article ,添寫基本信息后,在 Structure 一欄選擇 test ,對應的 Template 一欄也選擇 test 即可,然后在對應的元素域里添入合適的文本或者圖片,點擊預覽即可以看到如下界面,確定無問題后,點擊保存或者保存并發(fā)布按鈕即可完成 content 的定制。
4.JPG

通過以上三個步驟,我們就實現(xiàn)了定制 content 的功能。使用 Journal Portlet ,我們可以定制任何不同風格的 content 來展示必要的信息。

Liferay Portal學習筆記(二):使用CMS


更多文章、技術(shù)交流、商務合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯(lián)系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發(fā)表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 阿巴嘎旗| 军事| 西乌| 阿图什市| 乐清市| 紫金县| 舞阳县| 阿坝县| 新蔡县| 宣城市| 科技| 涪陵区| 滦平县| 松滋市| 黄浦区| 鸡东县| 壤塘县| 专栏| 安徽省| 海南省| 南宫市| 青阳县| 五莲县| 大悟县| 唐河县| 广水市| 万载县| 益阳市| 庐江县| 绍兴县| 临猗县| 南皮县| 延安市| 正宁县| 焦作市| 鄂托克前旗| 宁海县| 普兰县| 全南县| 东光县| 雷波县|