您可以建立內容版面配置,用於編排內容項目中的欄位在網站頁面上顯示時的版面配置。當內容項目新增至頁面時,它將會使用選擇的內容版面配置。
企業使用者可以依據開發人員提供的內容類型和版面配置,建立及使用內容項目。您可以從預設版面配置建立新的內容版面配置。內容類型若有多個關聯的內容版面配置,網站設計者不需要變更內容,就可以顯示不同相關資訊環境中的內容項目。
如果您在某個內容清單元件中使用內容版面配置,此內容版面配置會在每個內容項目重複出現一次。內容版面配置接著便由區段版面配置來編排。
您可以將內容版面配置匯出進行離線修改,然後再將它匯入並取代現有的內容版面配置。
建立內容版面配置:
此內容版面配置就會新增至您的元件。
註:
內容版面配置標題中只能使用文數字字元、連字號以及底線。系統就會在選取的資料夾中,以內容版面配置名稱加 .zip
副檔名,建立一個版面配置套件檔案。請將此檔案下載至您的開發環境以編輯其中的檔案。
這些檔案主要控制使用員工證內容版面配置之內容項目中欄位的版面配置。如果已啟用在網站中使用時新增對自訂設定值的支援,則系統還會另外建立一個名稱為 settings.html 的檔案,用來提供單一內容項目的預設呈現,以顯示該內容項目。
design.css
、layout.html
以及 render.js
檔案,以獲取想要的內容版面配置。
例如,下列檔案指定員工證的內容版面配置:
design.css
檔案:
.scs-tile-layout { font-family: 'Helvetica Neue', 'Segoe UI', sans-serif-regular, Helvetica, Arial; font-size: 16px; margin: 0px; padding: 0px; font-style: normal; color: #333; } .scs-tile-layout li { list-style: none; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 200; margin: 0px; } .scs-tile-layout-img-container { height: 150px; width: 100px; float: left; margin: 0em 0.5em 0em 0em; padding: 0px; border-radius: 3px; overflow: hidden; position: relative; } .scs-tile-layout-img { position: absolute; left: -100%; right: -100%; top: -100%; bottom: -100%; margin: auto; height: 100%; min-width: 100%; } .scs-tile-layout p { margin: 0px; }
layout.html
檔案:
{{#data.employee_profile_pictureURL}} <div class="scs-tile-layout-img-container"> <img class="scs-tile-layout-img" src="{{data.employee_profile_pictureURL}}" /> </div> {{/data.employee_profile_pictureURL}} <ul class="scs-tile-layout"> <li> <p><b>{{name}}</b></p> </li> <li> </li> <li> <p>{{data.employee_job_title}}</p> <p>{{data.employee_location}}</p> <p><b>Phone: </b>{{data.employee_phone}}</p> </li> {{#scsData.detailPageLink}} <li> <a href="{{scsData.detailPageLink}}" title="Go to detail page"><span class="detail-page">Profile</span></a> </li> {{/scsData.detailPageLink}} </ul>
render.js
檔案:
/* globals define */ define([ 'jquery', 'mustache', 'text!./layout.html', 'css!./design.css' ], function($, Mustache, templateHtml, css) { 'use strict'; function ContentLayout(params) { this.contentItemData = params.contentItemData || {}; this.scsData = params.scsData; this.contentClient = params.contentClient || (params.scsData ? params.scsData.contentClient : null); // retrieve the custom settings this.customSettiings = this.scsData.customSettingsData || {}; } ContentLayout.prototype = { render: function(parentObj) { var template, content = $.extend({}, this.contentItemData), contentClient = this.contentClient, contentType, secureContent = false; if (this.scsData) { content = $.extend(content, { 'scsData': this.scsData }); contentType = content.scsData.showPublishedContent === true ? 'published' : 'draft'; secureContent = content.scsData.secureContent; } if (contentClient) { var params = { 'itemGUID': typeof content.data.employee_profile_picture === 'string' ? content.data.employee_profile_picture : content.data.employee_profile_picture.id, 'contentType': contentType, 'secureContent': secureContent }; content.data.employee_profile_pictureURL = contentClient.getRenditionURL(params); } console.log(content); try { // Mustache template = Mustache.render(templateHtml, content); if (template) { $(parentObj).append(template); } } catch (e) { console.error(e.stack); } } }; return ContentLayout; });
如需有關編輯 render.js 和其他檔案的資訊,請參閱開發元件。
_folder.json
中的 GUID。修改過的內容版面配置便會匯入元件中。
您也可以匯出內容版面配置,並將它複製或移到另一個 Oracle Content Management 執行處理,然後在該處匯入。