<cms:template>標籤的使用

[王毅原創,轉載註明]

  <cms:template> 該標籤允許您把一個JSP頁面分割成多個元素,以便使用<cms:include>引入。

屬性:

Name
    element
Description
    在將要被<cms:include>標籤使用時候使用的名稱.
Required
    yes

標籤體:

模板中的任何 HTML, JSP 或者 JSTL 代碼.

示例用法:

<cms:template element="head">
<html>
<body>
This is the template head.<hr>
<!-- Main page body starts here -->
</cms:template>
<cms:template element="foot">
<!-- Main page body ends here -->
<hr>This is the template foot.
</body>
</html>
</cms:template>


=======================================
本標籤對應的API調用方法如下代碼:

    <%@ page session="false" import="org.opencms.jsp.*" %>
    <%
        CmsJspActionElement cms = new CmsJspActionElement(pageContext, request, response);
    %>
  
    <% if (cms.template("head")){ %>
    <html>
    <head>
    <title> <cms:property name="Title" escapeHtml="true"/> </title>
    </head>
    <body>
       This is the template head. <p>
    <% } %>
 
    <% if (cms.template("foot")){ %>
       <p> This is the template foot.
    </body>
    </html>
    <% } %>
=======================================

我的相關日誌:

2008-05-13 | <cms:template>標籤的使用
2008-05-12 | 對 OpenCms 的 <cms:user> 標籤的使用補充
2008-04-12 | <cms:param>標籤的使用
2008-04-11 | <cms:img>標籤的用法舉例說明
2008-04-10 | 再談<cms:contentaccess>標籤的使用
2008-04-09 | 淺談<cms:contentaccess>標籤的使用
2008-03-21 | <cms:contentload>標籤的使用
2007-12-14 | <cms:editable>標籤的使用
2007-12-13 | <cms:contentshow>標籤的使用
2007-12-12 | <cms:contentloop> 標籤的使用


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章