Używając polecenia cec create-contentlayout
, można w projekcie usługi Developer Cloud Service utworzyć układ zawartości dla typu zawartości.
Aby utworzyć układ zawartości w projekcie Developer Cloud Service, należy:
W oknie terminala przejść do katalogu cec-components
.
Wpisać polecenie cec create-contentlayout
w celu wyświetlenia opcji i przykładów polecenia:
Usage: cec create-contentlayout <name> Creates a content layout based on a content type from a local template or from CEC server. By default, an "overview" content layout is created. Optionally specify -s <style> to create in a different style. Valid values for <style> are: detail overview Options: --contenttype, -c <contenttype> Content layout is based on [required] --template, -t <template> Content type is from --server, -r flag to indicate the content type is from server --style, -s <style> Content layout style --addcustomsettings, -a Add support for custom settings when used in Sites --help, -h Show help [boolean] Examples: cec create-contentlayout Blog-Post-Overview-Layout -c Blog-Post -t BlogTemplate cec create-contentlayout Blog-Post-Detail-Layout -c Blog-Post -t BlogTemplate -s detail cec create-contentlayout Blog-Post-Overview-Layout -c Blog-Post -t BlogTemplate -a cec create-contentlayout Blog-Post-Overview-Layout -c Blog-Post -r cec create-contentlayout Blog-Post-Overview-Layout -c Blog-Post -r -s detail
Aby wyświetlić dostępne typy zawartości na serwerze, wpisać następujące polecenie:
cec list-server-content-types
Jak pokazano w akapicie "Usage", można utworzyć układ zawartości dla typu zawartości na serwerze Oracle Content Management albo dla typu zawartości z szablonach znajdujących się w folderze cec-components/src/main/templates
. Na przykład za pomocą następującego polecenia można utworzyć na serwerze układ zawartości dla danego typu:
cec create-contentlayout Blog-Post-Overview-Layout -c Blog-Post -r
Aby zmodyfikować układ zawartości, można edytować następujące pliki:
assets/layout.html
Ten plik określa widok HTML. Zob. Edytowanie układu zawartości w szablonie Mustache.
assets/design.css
Ten plik określa styl układu zawartości. Zob. Definiowanie stylów w pliku design.css.
assets/render.js
Ten plik określa dane używane w pliku layout.html
oraz umożliwia dodawanie dynamicznego działania do układu zawartości. Zob. Definiowanie modułu RequireJS.
Jeśli zostanie utworzony układ, który zezwala na ustawienia niestandardowe (przy użyciu opcji -a
podczas tworzenia układu), zostanie także utworzony dodatkowy plik o nazwie settings.html
, udostępniający domyślny sposób renderowania elementu zawartości, dzięki czemu może być on wyświetlany.