Sitemap
From phpCMS
Contents |
[edit] Creating a sitemap
[edit] Advantages of a sitemap
A sitemap provides a good orientation guide for your website visitors. Particularly if you have many menu layers it can be quite difficult for visitors to find one's way on a website.
Manual maintenance of such a sitemap is mostly very exhausting. It's also very difficult to keep the menu and the sitemap consistent.
Since version 1.0.9 phpCMS supports an automatic generation of sitemaps. A once-only defined sitemap-layout is enough to create an according sitemap automatically, if the menufile has been changed.
[edit] The definition within the menu template
The sitemap layout is defined in the menu template - like any other normal menu. Similar to the menu templates it is possible to define HTML code which shall be placed in front or behind the sitemap. Naturally you can define the layout of the sitemap entry by yourself. To make phpCMS recognizing the entry as a sitemap, the fieldname has to begin with TOC.. TOC in this case means "table of contents". After the TOC you have to enter the menu name, for which the sitemap shall be generated.
A sitemap entry for the main menu ("MAIN") for example could look like the following:
{TOC.MAIN.PRE} <table>
{TOC.MAIN.NORMAL} <tr><td>{MNAME}</td></tr>
{TOC.MAIN.PAST} </table>
As the examples shows, the menu entries are displayed with the field identifier "NORMAL" then. You can assign the above code to all menu layers simply by using copy and paste. So you'll receive a sitemap. As of version 1.2.1 you can also use the identifier "BETWEEN" to specify the code that should be displayed between two sitemap entries.
[edit] The definition within the site template
The sitemap needs its own template. In principle it is enough to use a copy of an existing template. You only have to enter the code for the sitemap to the place where the sitemap should be displayed. To integrate a sitemap into the template, you have to use the field identifier TOC followed by the menu class, from which on the sitemap shall be shown, with an added CLASS=.
For example, the needed code can look like the following:
[normal HTML code] {TOC CLASS="00"} [normal HTML code]
If only the menu entries from class 00.01 should be shown, you can use the following code:
[normal HTML code] {TOC CLASS="00.01"} [normal HTML code]
Attention: Both the white space after TOC and the quotation marks after CLASS are important and have to be noted.
This field identifier can also entered multiple with even or different class name into the template. A multiple entry for example can be used to create multiple columned sitemaps. To do this, you have to define for every main menu entry where it shall be displayed later in the sitemap.
[edit] Further needed files
To integrate the sitemap correctly into an existing project, you also need the following files:
- a project file and
- a content file
The project file can be copied from the original project file. You only have to enter the just created template instead of the existing template.
The content file rather is the name to call the sitemap in the browser. But it is also possible to fill additional content fields with some information, so for example you can display an additional text before the actual sitemap.
Now the sitemap is functionally.
[edit] Completing information
The sitemap is cached by phpCMS as well if you enabled the server-cache! Due to this issue you have to delete the server cache in case of changing the menu file. But this is recommended anyway, as the new menu structure will not the displayed.
[edit] Tips and tricks
[edit] XHTML sitemaps with lists
For a sitemap to be xhtml compliant you need to use a small workaround (phpCMS v. 1.2.0):
{TOC.MAIN.PRE}
<ul class="main_sitemap"><li style="__display__:__none;__">
{TOC.MAIN.NORMAL}
</li><li> <a href="{LINK}">{MNAME}</a> - {DESCRIPTION}
{TOC.MAIN.PAST}
</li></ul>
{TOC.SUB1.PRE}
<ul class="sub_sitemap"><li style="__display__:__none;__">
{TOC.SUB1.NORMAL}
</li><li> <a href="{LINK}">{MNAME}</a> - {DESCRIPTION}
{TOC.SUB1.PAST}
</li></ul>
Please remove the two Underlashes in the Style attribute, I must insert it because auf the SPAM-Filter
Main Page: User Documentation MainPage
« Previous Page: How to create menus | Top Page: how to work with phpCMS | Next Page: How to work with the full text search engine »

