SlideShare une entreprise Scribd logo
1  sur  34
Télécharger pour lire hors ligne
Andreas Zahner, Alkacon Software
Workshop Track
Bootstrap your templates
with OpenCms 9
09.10.2013
● The OpenCms 9 Bootstrap template
● Module structure
● Content containers
● Available content types
● Cloning OpenCms modules
● How to clone a module
● Customizing the cloned module
● Using another Bootstrap theme
● Modifying the formatter HTML output
● Creating pages using the customized formatters
● Add a new content type
2
Agenda
● Module Structure of previous OpenCms
versions:
● One Template module
● For each resource type, an extra module has been
developed including the type definition, XSDs,
localization and formatters
● OpenCms 9 Bootstrap template:
● Only 2 modules contain the template and all
necessary functionality for the website
● Reason: cloning the modules using the integrated
functions is easier and faster
3
Bootstrap template - Structure
● Schemas module
(com.alkacon.bootstrap.schemas)
● This module contains everything for the
definition of the available content elements
● Resource type definitions
● XSD files
● Localization bundles
4
Bootstrap template - Structure
● Formatters module
(com.alkacon.bootstrap.formatters)
● This module contains all components that are
used for the website frontend output
● Main template
● Template resources
● JSP elements for the template (e.g. navigation)
● Dynamic functions (e.g. Login box)
● Formatters for all types of schema module
5
Bootstrap template - Structure
● The bootstrap template has 5 content
containers
● Top container
● For full width content
● Middle left container, middle right container
● The column ratio can be adjusted using a property
Example: 9 – 3: left column uses 9 grid units, the right
column uses 3 grid units (the default setting)
● Bottom container
● For full width content
● Foot container
● Only used for sticky footers (i.e. flexible content)
6
Bootstrap template - Containers
7
Bootstrap template - Containers
● Screenshot of container structure
● Currently available content types:
● Flexible Content
● Image Row
● Hero / Jumbotron
● News Article
● Product
● Slider
● Tabs / Accordion
● Text Block
8
Bootstrap template - Types
● Advantages of cloning the shipped modules
● Fast and easy project start (no need to start with
"Adam & Eve")
● Use existing content types with different HTML
output
● Modify the page template by using
● A different container structure (optional)
● A different Bootstrap theme (optional)
● Clone existing content types and modify their fields
according to your requirements
9
Cloning OpenCms modules
● Use the dynamic function "Clone a module"
that is part of the demo formatter module for
clone operations
10
Cloning OpenCms modules
● The function form uses the Java bean
"CmsCloneModule" of the OpenCms core
package
"org.opencms.workplace.tools.modules"
● getter and setter methods for all configurable
options
● executeModuleClone() starts the clone process
● The module is copied first
● Internal references are adjusted in the copied module
● The module is added to the OpenCms module
configuration
● Optionally, the site contents references can be adjusted
to use the new module clone
11
Cloning OpenCms modules
● Clone the formatter module (1)
● Select the source formatters module from the drop
down list
● Be sure to uncheck the delete option if you want to
keep the old module in the system
● Enter the new module and author information
● Be sure that the package name of the module does not
exist yet
● For our examples, we create a clone named
"com.mycompany.formatters"
12
Cloning OpenCms modules
● Clone the formatter module (2)
● Translation options are only important when
cloning a module containing resource type
definitions
● Source and target prefix names: If the resource
types of the module have a prefix (like "bs"), this
will be replaced by the target prefix name
● The Formatters source module has to be entered
to ensure that the XSD files reference the correct
formatter JSPs after cloning all required modules
● Uncheck the option to replace schema locations
and resource types when cloning the formatters
module (i.e. without resource types)
13
Cloning OpenCms modules
● After cloning, the new module is shown in the
Module Management view
● The resources of the cloned module can be
checked below the /system/modules/ folder of
the root site
● If a module with resource type definitions was
cloned, the servlet container has to be
restarted
14
Cloning OpenCms modules
● Live Demo
15
Live Demo
Demo
Demo Demo
Demo
デモ
● Switching to another ready to use Bootstrap
theme
● All theme specific files (CSS, JavaScript, images)
are placed inside the resources/ folder of the
formatter module
● Delete all these files and replace them with the
necessary files of the theme you want to use
16
Customizing the cloned module
● Switching to another ready to use Bootstrap
theme
● Edit the template JSP to use the correct CSS and
JS files of the theme
● Adjust the HTML output of the template JSP
according to the requirements of the new theme (if
required)
17
Customizing the cloned module
...
<head>
...
<cms:headincludes type="css" closetags="true"
defaults="%(link.weak:/system/modules/com.mycompany.formatters/resources/css/bootstrap.min.c
ss)
|%(link.weak:/system/modules/com.mycompany.formatters/resources/css/bootstrap-
responsive.min.css)
|%(link.weak:/system/modules/com.mycompany.formatters/resources/css/bootstrap-
overrides.css)
...
|%(link.weak:/system/modules/com.mycompany.formatters/resources/css/page.css)" />
...
<cms:headincludes type="javascript" defaults="http://code.jquery.com/jquery-latest.js
|%(link.weak:/system/modules/com.mycompany.formatters/resources/js/bootstrap.min.js)
|%(link.weak:/system/modules/com.mycompany.formatters/resources/js/theme.js)" />
...
</head><body>
...
18
Customizing the cloned module
● Change the HTML output of the template
element JSPs (e.g. main navigation) for the
new theme
19
Customizing the cloned module
<div class="navbar">
<div class="navbar-inner">
<a class="btn btn-navbar" data-
toggle="collapse" data-target=".nav-
collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a><!-- /nav-collapse -->
<div class="nav-collapse collapse">
<ul class="nav top-2">
...
<div class="navbar navbar-inverse navbar-
static-top">
<div class="navbar-inner"><div
class="container">
<a class="btn btn-navbar" data-
toggle="collapse" data-target=".nav-
collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a><!-- /nav-collapse -->
<a class="brand"
href="index.html"><strong>My
Company</strong></a>
<div class="nav-collapse collapse">
<ul class="nav pull-right">
● Change the HTML output of the formatter JSPs
(e.g. text block) for the new theme
20
Customizing the cloned module
...
<cms:formatter var="content">
...
<c:if
test="${paragraph.value.Headline.isSet}">
<div
class="headline"><h3>${paragraph.rdfa.Hea
dline}>${paragraph.value.Headline}</h3></
div>
</c:if>
...
<c:if
test="${paragraph.value.Link.exists}">
<p><a class="btn-u btn-u-small"
href="<cms:link>${paragraph.value.Link.va
lue.URI}</cms:link>">${paragraph.value.Li
nk.value.Text}</a></p>
</c:if>
...
...
<cms:formatter var="content">
...
<c:if
test="${paragraph.value.Headline.isSet}">
<div
class="section_header"><h3>${paragraph.rd
fa.Headline}>${paragraph.value.Headline}<
/h3></div>
</c:if>
...
<c:if
test="${paragraph.value.Link.exists}">
<p><a class="btn btn-small"
href="<cms:link>${paragraph.value.Link.va
lue.URI}</cms:link>">${paragraph.value.Li
nk.value.Text}</a></p>
</c:if>
...
● Create a subsite that uses your cloned
template and formatters
● Set the "template" property value on the subsite
folder to your template JSP, e.g.
"/system/modules/com.mycompany.formatters/tem
plates/bootstrap-page.jsp"
21
Customizing the cloned module
● Edit the subsite configuration to make the
content types use the correct formatter JSPs if
only the formatter module was cloned
22
Customizing the cloned module
● After these steps, you can start creating your
pages with the cloned template and formatters
23
Customizing the cloned module
● Live Demo
24
Live Demo
Demo
Demo Demo
Demo
デモ
● Add a new content type that you need for your
website
● Example: Feature content that shows e.g.
product features with images in a nice boxed
layout (see screenshot from Bootstrap theme)
25
Adding a new content type
● If you do not already use your own schemas module,
create one, e.g. "com.mycompany.schemas"
● Create a new OpenCms XML Schema Definition
(XSD) file in the schemas/ folder of the module
26
Add a new content type
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xsd:include schemaLocation="opencms://opencms-xmlcontent.xsd"/>
<xsd:include schemaLocation="opencms://system/.../schemas/nested/featureitem.xsd"/>
<xsd:element name="MyCompanyFeatures" type="OpenCmsMyCompanyFeatures"/>
...
<xsd:complexType name="OpenCmsMyCompanyFeature">
<xsd:sequence>
<xsd:element name="Title" type="OpenCmsString" />
<xsd:element name="Item" type="OpenCmsMyCompanyFeatureItem" minOccurs="3" maxOccurs="4" />
</xsd:sequence>
<xsd:attribute name="language" type="OpenCmsLocale" use="required"/>
</xsd:complexType>
...
● Upload file icons (a small 16x16 version for the
workplace, a 24x24 version for the content
editor) for the new type to the folder
/system/workplace/resources/filetypes/
● Add these file icons to the module resources to
ensure they are exported together with the
module
27
Add a new content type
● Stop the servlet container and add the resource
type definition to the module in the "opencms-
modules.xml" configuration file
28
Add a new content type
<module>
<name>com.mycompany.schemas</name>
...
<parameters/>
<resourcetypes>
<type class="org.opencms.file.types.CmsResourceTypeXmlContent" name="my-feature" id="33333">
<param name="schema">/system/modules/com.mycompany.schemas/schemas/feature.xsd</param>
</type>
</resourcetypes>
<explorertypes>
<explorertype name="my-feature" key="fileicon.my-feature" icon="my-feature.png" bigicon="my-feature_big.png"
reference="xmlcontent">
<newresource page="structurecontent" uri="newresource_xmlcontent.jsp?newresourcetype=my-feature"
order="130" autosetnavigation="false" autosettitle="false" info="desc.my-feature"/>
</explorertype>
</explorertypes>
</module>
● Create a formatter JSP file that renders the
elements of the new content type
● Configure the resource type either in the
module configuration for system wide usage or
in the subsite configuration file
29
Add a new content type
● Localize the editor elements and eventual
frontend output
30
Add a new content type
● Resulting feature content in OpenCms
31
Add a new content type
● Live Demo
32
Live Demo
Demo
Demo Demo
Demo
デモ
● Any Questions?
33
Any Questions?
Fragen?
Questions ?
Questiones?
¿Preguntas?質問
Andreas Zahner
Alkacon Software GmbH
http://www.alkacon.com
http://www.opencms.org
Thank you very much for your
attention!
34

Contenu connexe

Tendances

Szkolenie drupal-podstawy 2
Szkolenie drupal-podstawy 2Szkolenie drupal-podstawy 2
Szkolenie drupal-podstawy 2
Grzegorz Bartman
 

Tendances (20)

OpenCms Days 2014 - Enhancing OpenCms front end development with Sass and Grunt
OpenCms Days 2014 - Enhancing OpenCms front end development with Sass and GruntOpenCms Days 2014 - Enhancing OpenCms front end development with Sass and Grunt
OpenCms Days 2014 - Enhancing OpenCms front end development with Sass and Grunt
 
OpenCms Days 2015 Hidden features of OpenCms
OpenCms Days 2015 Hidden features of OpenCmsOpenCms Days 2015 Hidden features of OpenCms
OpenCms Days 2015 Hidden features of OpenCms
 
OpenCms Days 2015 Creating Apps for the OpenCms 10 workplace
OpenCms Days 2015  Creating Apps for the OpenCms 10 workplace OpenCms Days 2015  Creating Apps for the OpenCms 10 workplace
OpenCms Days 2015 Creating Apps for the OpenCms 10 workplace
 
OpenCms Days 2013 - Site Management Tool
OpenCms Days 2013 - Site Management ToolOpenCms Days 2013 - Site Management Tool
OpenCms Days 2013 - Site Management Tool
 
OpenCms Days 2016: Next generation content repository
OpenCms Days 2016: Next generation content repository OpenCms Days 2016: Next generation content repository
OpenCms Days 2016: Next generation content repository
 
OpenCms Days 2015 Advanced Solr Searching
OpenCms Days 2015 Advanced Solr SearchingOpenCms Days 2015 Advanced Solr Searching
OpenCms Days 2015 Advanced Solr Searching
 
OpenCms Days 2015 Next generation repository
OpenCms Days 2015  Next generation repositoryOpenCms Days 2015  Next generation repository
OpenCms Days 2015 Next generation repository
 
OpenCms Days 2016: OpenCms at the swiss seismological service
OpenCms Days 2016: OpenCms at the swiss seismological serviceOpenCms Days 2016: OpenCms at the swiss seismological service
OpenCms Days 2016: OpenCms at the swiss seismological service
 
OpenCms Days 2015 How do you develop for OpenCms?
OpenCms Days 2015 How do you develop for OpenCms?OpenCms Days 2015 How do you develop for OpenCms?
OpenCms Days 2015 How do you develop for OpenCms?
 
Drupal training-1-in-mumbai
Drupal training-1-in-mumbaiDrupal training-1-in-mumbai
Drupal training-1-in-mumbai
 
OpenCms Days 2014 - OpenCms content editor and pdf extensions
OpenCms Days 2014 - OpenCms content editor and pdf extensionsOpenCms Days 2014 - OpenCms content editor and pdf extensions
OpenCms Days 2014 - OpenCms content editor and pdf extensions
 
OVERVIEW: Chromium Source Tree
OVERVIEW: Chromium Source TreeOVERVIEW: Chromium Source Tree
OVERVIEW: Chromium Source Tree
 
Introduction to Moodle Development
Introduction to Moodle DevelopmentIntroduction to Moodle Development
Introduction to Moodle Development
 
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan KrausHTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
 
Openbit szkolenie-drupal-podstawy 2
Openbit szkolenie-drupal-podstawy 2Openbit szkolenie-drupal-podstawy 2
Openbit szkolenie-drupal-podstawy 2
 
Szkolenie drupal-podstawy 2
Szkolenie drupal-podstawy 2Szkolenie drupal-podstawy 2
Szkolenie drupal-podstawy 2
 
Extending JBoss EPP and Site Publisher your way
Extending JBoss EPP and Site Publisher your wayExtending JBoss EPP and Site Publisher your way
Extending JBoss EPP and Site Publisher your way
 
How Browsers Work
How Browsers Work How Browsers Work
How Browsers Work
 
Architektura html, css i javascript - Jan Kraus
Architektura html, css i javascript - Jan KrausArchitektura html, css i javascript - Jan Kraus
Architektura html, css i javascript - Jan Kraus
 
The OpenEuropa Initiative
The OpenEuropa InitiativeThe OpenEuropa Initiative
The OpenEuropa Initiative
 

En vedette

Internal and external business environment
Internal and external business environmentInternal and external business environment
Internal and external business environment
Aashish Sahi
 

En vedette (15)

OpenCms Days 2015 OpenCms X marks the spot
OpenCms Days 2015 OpenCms X marks the spotOpenCms Days 2015 OpenCms X marks the spot
OpenCms Days 2015 OpenCms X marks the spot
 
OpenCms Days 2013 - OpenCms Partner Program
OpenCms Days 2013 - OpenCms Partner ProgramOpenCms Days 2013 - OpenCms Partner Program
OpenCms Days 2013 - OpenCms Partner Program
 
OpenCms Days 2012 - Developing OpenCms with Gradle
OpenCms Days 2012 - Developing OpenCms with GradleOpenCms Days 2012 - Developing OpenCms with Gradle
OpenCms Days 2012 - Developing OpenCms with Gradle
 
OpenCms Days 2013 - Gradle based OpenCms build automated setup
OpenCms Days 2013 - Gradle based OpenCms build automated setupOpenCms Days 2013 - Gradle based OpenCms build automated setup
OpenCms Days 2013 - Gradle based OpenCms build automated setup
 
OpenCmsDays 2013 - Using OpenCms 9 folders as a network drive
OpenCmsDays 2013 - Using OpenCms 9 folders as a network driveOpenCmsDays 2013 - Using OpenCms 9 folders as a network drive
OpenCmsDays 2013 - Using OpenCms 9 folders as a network drive
 
これからのCMSマーケットトレンドとPHP (for fukuoka.php)
これからのCMSマーケットトレンドとPHP (for fukuoka.php)これからのCMSマーケットトレンドとPHP (for fukuoka.php)
これからのCMSマーケットトレンドとPHP (for fukuoka.php)
 
OpenCms Days 2013 - Outsourcing OpenCms Template Design
OpenCms Days 2013 - Outsourcing OpenCms Template DesignOpenCms Days 2013 - Outsourcing OpenCms Template Design
OpenCms Days 2013 - Outsourcing OpenCms Template Design
 
OpenCms Days 2013 - Social Connect for OpenCms Portal
OpenCms Days 2013 - Social Connect for OpenCms PortalOpenCms Days 2013 - Social Connect for OpenCms Portal
OpenCms Days 2013 - Social Connect for OpenCms Portal
 
OpenCms Days 2012 - OpenCms 8.5: Accessing the VFS repository using CMIS
OpenCms Days 2012 - OpenCms 8.5: Accessing the VFS repository using CMISOpenCms Days 2012 - OpenCms 8.5: Accessing the VFS repository using CMIS
OpenCms Days 2012 - OpenCms 8.5: Accessing the VFS repository using CMIS
 
OpenCms Days 2012 - How Software AG is optimizing workflows with OpenCms 8 an...
OpenCms Days 2012 - How Software AG is optimizing workflows with OpenCms 8 an...OpenCms Days 2012 - How Software AG is optimizing workflows with OpenCms 8 an...
OpenCms Days 2012 - How Software AG is optimizing workflows with OpenCms 8 an...
 
OpenCms Days 2015 OpenGovernment
OpenCms Days 2015 OpenGovernmentOpenCms Days 2015 OpenGovernment
OpenCms Days 2015 OpenGovernment
 
OpenCms Days 2016: Keynote - Introducing OpenCms 10.5
OpenCms Days 2016:   Keynote - Introducing OpenCms 10.5OpenCms Days 2016:   Keynote - Introducing OpenCms 10.5
OpenCms Days 2016: Keynote - Introducing OpenCms 10.5
 
OpenCms Days 2014 - Introducing the 9.5 OpenCms documentation
OpenCms Days 2014 - Introducing the 9.5 OpenCms documentationOpenCms Days 2014 - Introducing the 9.5 OpenCms documentation
OpenCms Days 2014 - Introducing the 9.5 OpenCms documentation
 
Eurelis - Construire une usine à sites
Eurelis - Construire une usine à sitesEurelis - Construire une usine à sites
Eurelis - Construire une usine à sites
 
Internal and external business environment
Internal and external business environmentInternal and external business environment
Internal and external business environment
 

Similaire à OpenCms Days 2013 - Bootstrap your templates

webpack introductionNotice Demystifyingf
webpack introductionNotice Demystifyingfwebpack introductionNotice Demystifyingf
webpack introductionNotice Demystifyingf
MrVMNair
 

Similaire à OpenCms Days 2013 - Bootstrap your templates (20)

Modul-Entwicklung für Magento, OXID eShop und Shopware (2013)
Modul-Entwicklung für Magento, OXID eShop und Shopware (2013)Modul-Entwicklung für Magento, OXID eShop und Shopware (2013)
Modul-Entwicklung für Magento, OXID eShop und Shopware (2013)
 
How to Write Custom Modules for PHP-based E-Commerce Systems (2011)
How to Write Custom Modules for PHP-based E-Commerce Systems (2011)How to Write Custom Modules for PHP-based E-Commerce Systems (2011)
How to Write Custom Modules for PHP-based E-Commerce Systems (2011)
 
OpenCms Days 2012 - OpenCms 8.5: Using Apache Solr to retrieve content
OpenCms Days 2012 - OpenCms 8.5: Using Apache Solr to retrieve contentOpenCms Days 2012 - OpenCms 8.5: Using Apache Solr to retrieve content
OpenCms Days 2012 - OpenCms 8.5: Using Apache Solr to retrieve content
 
Social Connections VI — IBM Connections Extensions and Themes Demystified
Social Connections VI — IBM Connections Extensions and Themes DemystifiedSocial Connections VI — IBM Connections Extensions and Themes Demystified
Social Connections VI — IBM Connections Extensions and Themes Demystified
 
Introduction to BOOTSTRAP
Introduction to BOOTSTRAPIntroduction to BOOTSTRAP
Introduction to BOOTSTRAP
 
Custom gutenberg block development with React
Custom gutenberg block development with ReactCustom gutenberg block development with React
Custom gutenberg block development with React
 
Webpack Introduction
Webpack IntroductionWebpack Introduction
Webpack Introduction
 
Thinking in Components
Thinking in ComponentsThinking in Components
Thinking in Components
 
webpack introductionNotice Demystifyingf
webpack introductionNotice Demystifyingfwebpack introductionNotice Demystifyingf
webpack introductionNotice Demystifyingf
 
Twitter bootstrap training_session_ppt
Twitter bootstrap training_session_pptTwitter bootstrap training_session_ppt
Twitter bootstrap training_session_ppt
 
Blisstering drupal module development ppt v1.2
Blisstering drupal module development ppt v1.2Blisstering drupal module development ppt v1.2
Blisstering drupal module development ppt v1.2
 
SHOW202: How to customize Lotus Quickr Templates Using HTML, Javascript and C...
SHOW202: How to customize Lotus Quickr Templates Using HTML, Javascript and C...SHOW202: How to customize Lotus Quickr Templates Using HTML, Javascript and C...
SHOW202: How to customize Lotus Quickr Templates Using HTML, Javascript and C...
 
The emerging world of mongo db csp
The emerging world of mongo db   cspThe emerging world of mongo db   csp
The emerging world of mongo db csp
 
Gutenberg (WidgiLabs Training Sessions)
Gutenberg  (WidgiLabs Training Sessions)Gutenberg  (WidgiLabs Training Sessions)
Gutenberg (WidgiLabs Training Sessions)
 
Web components - An Introduction
Web components - An IntroductionWeb components - An Introduction
Web components - An Introduction
 
How Joomla! builds a webpage (annotated)
How Joomla! builds a webpage (annotated)How Joomla! builds a webpage (annotated)
How Joomla! builds a webpage (annotated)
 
Liferay (DXP) 7 Tech Meetup for Developers
Liferay (DXP) 7 Tech Meetup for DevelopersLiferay (DXP) 7 Tech Meetup for Developers
Liferay (DXP) 7 Tech Meetup for Developers
 
MongoDB Days Silicon Valley: Building Applications with the MEAN Stack
MongoDB Days Silicon Valley: Building Applications with the MEAN StackMongoDB Days Silicon Valley: Building Applications with the MEAN Stack
MongoDB Days Silicon Valley: Building Applications with the MEAN Stack
 
Getting Healthy with Magnolia, Blossom and Spring
Getting Healthy with Magnolia, Blossom and SpringGetting Healthy with Magnolia, Blossom and Spring
Getting Healthy with Magnolia, Blossom and Spring
 
Magento x codekit x sass x compass x skeleton responsive grid
Magento x codekit x sass x compass x skeleton responsive gridMagento x codekit x sass x compass x skeleton responsive grid
Magento x codekit x sass x compass x skeleton responsive grid
 

Plus de Alkacon Software GmbH & Co. KG

Plus de Alkacon Software GmbH & Co. KG (12)

OpenCms Days 2016: Participation and transparency portals with OpenCms
OpenCms Days 2016: Participation and transparency portals with OpenCmsOpenCms Days 2016: Participation and transparency portals with OpenCms
OpenCms Days 2016: Participation and transparency portals with OpenCms
 
OpenCms Days 2015 OCEE explained
OpenCms Days 2015 OCEE explainedOpenCms Days 2015 OCEE explained
OpenCms Days 2015 OCEE explained
 
OpenCms Days 2015 OpenCms at erarta
OpenCms Days 2015 OpenCms at erarta OpenCms Days 2015 OpenCms at erarta
OpenCms Days 2015 OpenCms at erarta
 
OpenCms Days 2015 Arkema, a leading chemicals company
OpenCms Days 2015 Arkema, a leading chemicals companyOpenCms Days 2015 Arkema, a leading chemicals company
OpenCms Days 2015 Arkema, a leading chemicals company
 
OpenCms Days 2014 - How Techem handles international customer portals
OpenCms Days 2014 - How Techem handles international customer portalsOpenCms Days 2014 - How Techem handles international customer portals
OpenCms Days 2014 - How Techem handles international customer portals
 
OpenCms Days 2014 - OpenCms cloud setup with the FI-TS
OpenCms Days 2014 - OpenCms cloud setup with the FI-TSOpenCms Days 2014 - OpenCms cloud setup with the FI-TS
OpenCms Days 2014 - OpenCms cloud setup with the FI-TS
 
OpenCms Days 2014 - OpenCms Module Development and Deployment with IntelliJ, ...
OpenCms Days 2014 - OpenCms Module Development and Deployment with IntelliJ, ...OpenCms Days 2014 - OpenCms Module Development and Deployment with IntelliJ, ...
OpenCms Days 2014 - OpenCms Module Development and Deployment with IntelliJ, ...
 
OpenCms Days 2014 - OpenCms 9 - A video tube?
OpenCms Days 2014 - OpenCms 9 - A video tube?OpenCms Days 2014 - OpenCms 9 - A video tube?
OpenCms Days 2014 - OpenCms 9 - A video tube?
 
OpenCms Days 2014 - User Generated Content in OpenCms 9.5
OpenCms Days 2014 - User Generated Content in OpenCms 9.5OpenCms Days 2014 - User Generated Content in OpenCms 9.5
OpenCms Days 2014 - User Generated Content in OpenCms 9.5
 
OpenCms Days 2014 - Updating to OpenCms 9.5
OpenCms Days 2014 - Updating to OpenCms 9.5OpenCms Days 2014 - Updating to OpenCms 9.5
OpenCms Days 2014 - Updating to OpenCms 9.5
 
OpenCms Days 2014 - Using the SOLR collector
OpenCms Days 2014 - Using the SOLR collectorOpenCms Days 2014 - Using the SOLR collector
OpenCms Days 2014 - Using the SOLR collector
 
OpenCms Days 2014 Keynote - Step up to OpenCms 9.5
OpenCms Days 2014 Keynote - Step up to OpenCms 9.5OpenCms Days 2014 Keynote - Step up to OpenCms 9.5
OpenCms Days 2014 Keynote - Step up to OpenCms 9.5
 

Dernier

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Dernier (20)

CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 

OpenCms Days 2013 - Bootstrap your templates

  • 1. Andreas Zahner, Alkacon Software Workshop Track Bootstrap your templates with OpenCms 9 09.10.2013
  • 2. ● The OpenCms 9 Bootstrap template ● Module structure ● Content containers ● Available content types ● Cloning OpenCms modules ● How to clone a module ● Customizing the cloned module ● Using another Bootstrap theme ● Modifying the formatter HTML output ● Creating pages using the customized formatters ● Add a new content type 2 Agenda
  • 3. ● Module Structure of previous OpenCms versions: ● One Template module ● For each resource type, an extra module has been developed including the type definition, XSDs, localization and formatters ● OpenCms 9 Bootstrap template: ● Only 2 modules contain the template and all necessary functionality for the website ● Reason: cloning the modules using the integrated functions is easier and faster 3 Bootstrap template - Structure
  • 4. ● Schemas module (com.alkacon.bootstrap.schemas) ● This module contains everything for the definition of the available content elements ● Resource type definitions ● XSD files ● Localization bundles 4 Bootstrap template - Structure
  • 5. ● Formatters module (com.alkacon.bootstrap.formatters) ● This module contains all components that are used for the website frontend output ● Main template ● Template resources ● JSP elements for the template (e.g. navigation) ● Dynamic functions (e.g. Login box) ● Formatters for all types of schema module 5 Bootstrap template - Structure
  • 6. ● The bootstrap template has 5 content containers ● Top container ● For full width content ● Middle left container, middle right container ● The column ratio can be adjusted using a property Example: 9 – 3: left column uses 9 grid units, the right column uses 3 grid units (the default setting) ● Bottom container ● For full width content ● Foot container ● Only used for sticky footers (i.e. flexible content) 6 Bootstrap template - Containers
  • 7. 7 Bootstrap template - Containers ● Screenshot of container structure
  • 8. ● Currently available content types: ● Flexible Content ● Image Row ● Hero / Jumbotron ● News Article ● Product ● Slider ● Tabs / Accordion ● Text Block 8 Bootstrap template - Types
  • 9. ● Advantages of cloning the shipped modules ● Fast and easy project start (no need to start with "Adam & Eve") ● Use existing content types with different HTML output ● Modify the page template by using ● A different container structure (optional) ● A different Bootstrap theme (optional) ● Clone existing content types and modify their fields according to your requirements 9 Cloning OpenCms modules
  • 10. ● Use the dynamic function "Clone a module" that is part of the demo formatter module for clone operations 10 Cloning OpenCms modules
  • 11. ● The function form uses the Java bean "CmsCloneModule" of the OpenCms core package "org.opencms.workplace.tools.modules" ● getter and setter methods for all configurable options ● executeModuleClone() starts the clone process ● The module is copied first ● Internal references are adjusted in the copied module ● The module is added to the OpenCms module configuration ● Optionally, the site contents references can be adjusted to use the new module clone 11 Cloning OpenCms modules
  • 12. ● Clone the formatter module (1) ● Select the source formatters module from the drop down list ● Be sure to uncheck the delete option if you want to keep the old module in the system ● Enter the new module and author information ● Be sure that the package name of the module does not exist yet ● For our examples, we create a clone named "com.mycompany.formatters" 12 Cloning OpenCms modules
  • 13. ● Clone the formatter module (2) ● Translation options are only important when cloning a module containing resource type definitions ● Source and target prefix names: If the resource types of the module have a prefix (like "bs"), this will be replaced by the target prefix name ● The Formatters source module has to be entered to ensure that the XSD files reference the correct formatter JSPs after cloning all required modules ● Uncheck the option to replace schema locations and resource types when cloning the formatters module (i.e. without resource types) 13 Cloning OpenCms modules
  • 14. ● After cloning, the new module is shown in the Module Management view ● The resources of the cloned module can be checked below the /system/modules/ folder of the root site ● If a module with resource type definitions was cloned, the servlet container has to be restarted 14 Cloning OpenCms modules
  • 15. ● Live Demo 15 Live Demo Demo Demo Demo Demo デモ
  • 16. ● Switching to another ready to use Bootstrap theme ● All theme specific files (CSS, JavaScript, images) are placed inside the resources/ folder of the formatter module ● Delete all these files and replace them with the necessary files of the theme you want to use 16 Customizing the cloned module
  • 17. ● Switching to another ready to use Bootstrap theme ● Edit the template JSP to use the correct CSS and JS files of the theme ● Adjust the HTML output of the template JSP according to the requirements of the new theme (if required) 17 Customizing the cloned module
  • 18. ... <head> ... <cms:headincludes type="css" closetags="true" defaults="%(link.weak:/system/modules/com.mycompany.formatters/resources/css/bootstrap.min.c ss) |%(link.weak:/system/modules/com.mycompany.formatters/resources/css/bootstrap- responsive.min.css) |%(link.weak:/system/modules/com.mycompany.formatters/resources/css/bootstrap- overrides.css) ... |%(link.weak:/system/modules/com.mycompany.formatters/resources/css/page.css)" /> ... <cms:headincludes type="javascript" defaults="http://code.jquery.com/jquery-latest.js |%(link.weak:/system/modules/com.mycompany.formatters/resources/js/bootstrap.min.js) |%(link.weak:/system/modules/com.mycompany.formatters/resources/js/theme.js)" /> ... </head><body> ... 18 Customizing the cloned module
  • 19. ● Change the HTML output of the template element JSPs (e.g. main navigation) for the new theme 19 Customizing the cloned module <div class="navbar"> <div class="navbar-inner"> <a class="btn btn-navbar" data- toggle="collapse" data-target=".nav- collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </a><!-- /nav-collapse --> <div class="nav-collapse collapse"> <ul class="nav top-2"> ... <div class="navbar navbar-inverse navbar- static-top"> <div class="navbar-inner"><div class="container"> <a class="btn btn-navbar" data- toggle="collapse" data-target=".nav- collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </a><!-- /nav-collapse --> <a class="brand" href="index.html"><strong>My Company</strong></a> <div class="nav-collapse collapse"> <ul class="nav pull-right">
  • 20. ● Change the HTML output of the formatter JSPs (e.g. text block) for the new theme 20 Customizing the cloned module ... <cms:formatter var="content"> ... <c:if test="${paragraph.value.Headline.isSet}"> <div class="headline"><h3>${paragraph.rdfa.Hea dline}>${paragraph.value.Headline}</h3></ div> </c:if> ... <c:if test="${paragraph.value.Link.exists}"> <p><a class="btn-u btn-u-small" href="<cms:link>${paragraph.value.Link.va lue.URI}</cms:link>">${paragraph.value.Li nk.value.Text}</a></p> </c:if> ... ... <cms:formatter var="content"> ... <c:if test="${paragraph.value.Headline.isSet}"> <div class="section_header"><h3>${paragraph.rd fa.Headline}>${paragraph.value.Headline}< /h3></div> </c:if> ... <c:if test="${paragraph.value.Link.exists}"> <p><a class="btn btn-small" href="<cms:link>${paragraph.value.Link.va lue.URI}</cms:link>">${paragraph.value.Li nk.value.Text}</a></p> </c:if> ...
  • 21. ● Create a subsite that uses your cloned template and formatters ● Set the "template" property value on the subsite folder to your template JSP, e.g. "/system/modules/com.mycompany.formatters/tem plates/bootstrap-page.jsp" 21 Customizing the cloned module
  • 22. ● Edit the subsite configuration to make the content types use the correct formatter JSPs if only the formatter module was cloned 22 Customizing the cloned module
  • 23. ● After these steps, you can start creating your pages with the cloned template and formatters 23 Customizing the cloned module
  • 24. ● Live Demo 24 Live Demo Demo Demo Demo Demo デモ
  • 25. ● Add a new content type that you need for your website ● Example: Feature content that shows e.g. product features with images in a nice boxed layout (see screenshot from Bootstrap theme) 25 Adding a new content type
  • 26. ● If you do not already use your own schemas module, create one, e.g. "com.mycompany.schemas" ● Create a new OpenCms XML Schema Definition (XSD) file in the schemas/ folder of the module 26 Add a new content type <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xsd:include schemaLocation="opencms://opencms-xmlcontent.xsd"/> <xsd:include schemaLocation="opencms://system/.../schemas/nested/featureitem.xsd"/> <xsd:element name="MyCompanyFeatures" type="OpenCmsMyCompanyFeatures"/> ... <xsd:complexType name="OpenCmsMyCompanyFeature"> <xsd:sequence> <xsd:element name="Title" type="OpenCmsString" /> <xsd:element name="Item" type="OpenCmsMyCompanyFeatureItem" minOccurs="3" maxOccurs="4" /> </xsd:sequence> <xsd:attribute name="language" type="OpenCmsLocale" use="required"/> </xsd:complexType> ...
  • 27. ● Upload file icons (a small 16x16 version for the workplace, a 24x24 version for the content editor) for the new type to the folder /system/workplace/resources/filetypes/ ● Add these file icons to the module resources to ensure they are exported together with the module 27 Add a new content type
  • 28. ● Stop the servlet container and add the resource type definition to the module in the "opencms- modules.xml" configuration file 28 Add a new content type <module> <name>com.mycompany.schemas</name> ... <parameters/> <resourcetypes> <type class="org.opencms.file.types.CmsResourceTypeXmlContent" name="my-feature" id="33333"> <param name="schema">/system/modules/com.mycompany.schemas/schemas/feature.xsd</param> </type> </resourcetypes> <explorertypes> <explorertype name="my-feature" key="fileicon.my-feature" icon="my-feature.png" bigicon="my-feature_big.png" reference="xmlcontent"> <newresource page="structurecontent" uri="newresource_xmlcontent.jsp?newresourcetype=my-feature" order="130" autosetnavigation="false" autosettitle="false" info="desc.my-feature"/> </explorertype> </explorertypes> </module>
  • 29. ● Create a formatter JSP file that renders the elements of the new content type ● Configure the resource type either in the module configuration for system wide usage or in the subsite configuration file 29 Add a new content type
  • 30. ● Localize the editor elements and eventual frontend output 30 Add a new content type
  • 31. ● Resulting feature content in OpenCms 31 Add a new content type
  • 32. ● Live Demo 32 Live Demo Demo Demo Demo Demo デモ
  • 33. ● Any Questions? 33 Any Questions? Fragen? Questions ? Questiones? ¿Preguntas?質問
  • 34. Andreas Zahner Alkacon Software GmbH http://www.alkacon.com http://www.opencms.org Thank you very much for your attention! 34