Example template with tree menu

(Difference between revisions)
Jump to: navigation, search
(New page: Here is an example of a page template, which has a navigational menu generated as a tree from folder structure. == Location of template == === A new module for a site === I create a new...)
 
Line 21: Line 21:
 
It is good to set the '''export''' property on that folder to '''true''', so they are exported from database to a static file
 
It is good to set the '''export''' property on that folder to '''true''', so they are exported from database to a static file
 
to improve speed.
 
to improve speed.
 +
 +
== Page title and index.html files ==
 +
 +
I was solving the problem of index.html and navigation in OpenCMS for years and here is my solution.
 +
 +
The problem is, that when you nave a '''folder''' with set navigation, it can have a Title and a NavText properties. But it should also contain
 +
a file '''index.html''' which can also have a Title and a NavText. These can be inconsistent with the setting of the folder.
 +
 +
My solution is , that I set Title and NavText on the folder, but I '''do not set Title and NavText''' on the index.html.
 +
 +
In the page template, I use
 +
 +
<source lang="html4strict">
 +
<title> <cms:property name="Title" file="search" escapeHtml="true" /></title>
 +
</source>
 +
 +
The '''file="search"''' causes that the title of the index.html file be inherited from the parent folder, so it cannot be incosistent.

Revision as of 11:56, 22 January 2010

Here is an example of a page template, which has a navigational menu generated as a tree from folder structure.

Contents

Location of template

A new module for a site

I create a new module for every web site. For example, let's say I am creating a site www.example.com.

First I create a new folder /sites/example, set its "Title" (it is displayd then in workplace as the name of the site), edit opencms-system.xml to addd mapping for it, restart tomcat.

Then I create the module. I go to Administration - Module management, click New module, fill Package name as com.example.site, check all checkboxes for creating folders..

Then I go to Module Resources and I add a new resource /sites/example so that the site pages are part of the module.

Template and resources location

The template then should be located in the /system/modules/com.example.site/templates/ folder.

The images, CSS and JavaScript files it uses shoudl be located in the /system/modules/com.example.site/resources/ folder. It is good to set the export property on that folder to true, so they are exported from database to a static file to improve speed.

Page title and index.html files

I was solving the problem of index.html and navigation in OpenCMS for years and here is my solution.

The problem is, that when you nave a folder with set navigation, it can have a Title and a NavText properties. But it should also contain a file index.html which can also have a Title and a NavText. These can be inconsistent with the setting of the folder.

My solution is , that I set Title and NavText on the folder, but I do not set Title and NavText on the index.html.

In the page template, I use

<title> <cms:property name="Title" file="search" escapeHtml="true" /></title>

The file="search" causes that the title of the index.html file be inherited from the parent folder, so it cannot be incosistent.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox