Solprovider Lenya Kongregate Registration for Free Flash Games and Chat with solprovider

Static Pages

Some pages on a site do not belong in the menus. Examples include:
Contact Us
Legal Terms and Conditions
Sitemap
Search

These items belong on every page, but do not belong to the tree structure of the menus. They are often placed in the footer of every page. The rest of this article explains how to handle this.

The first decision is whether each page belongs on the menus. Any page on the menus can be handled by Lenya's standard functionality, so ignore them.

The second decision is whether each page belongs on the sitemap. Pages that belong on the sitemap must be created using Lenya. Then go to the Site tab, and set the visibility to false:
INFO: Visibility in navigation: visible
MENU: Edit - Change node visibility - "Change" button
INFO: Visibility in navigation:hidden

Now add the links to any static pages (whether hidden or missing from your sitemap) to your XSL. To create a common footer, create a file {pub}/xslt/common.xsl
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:i18n="http://apache.org/cocoon/i18n/2.1">

<xsl:param name="root"/>
<xsl:param name="document-id"/>
<xsl:param name="language"/>

<xsl:template name="footer">
<xsl:param name="showSitemap"/>
<P><A HREF="{$root}/contact_{$language}.html">
<i18n:text>Contact Us</i18n:text></A></P>
<P><A HREF="{$root}/terms_{$language}.html">
<i18n:text>Legal Conditions</i18n:text></A></P>
<xsl:if test="$showSitemap != '0'">
<P><A HREF="{$url}?lenya.usecase=map">
<i18n:text>Sitemap</i18n:text></P></A>
</xsl:if>
<P><xsl:apply-templates select="xhtml:div[@id = 'search']"/></P>
</xsl:template>
</xsl:stylesheet>


Explanation:
A. This assumes you are passing the visitor's chosen language to your XSL. See Language for details.

B. This assumes you are using my code for "sitemap". This demonstrates how to control what shows in the footer. The "showSitemap" variable is set to "0" in the Sitemap XSL so the link for itself disappears.

C. Always use i18n for static text. In this example, "Contact Us", "Legal Conditions", and "Sitemap" must be added to the cms_xx.xml for each language.

D. For the example, each link is on a separate line. In my publication, the footer is a table row with a few spaces between the links. Change the code to fit your site.

Now add the footer to the XSL for each page. For the default publication, start with page2xhtml.xsl

Immediately after the stylesheet tag, add:
<xsl:import href="common.xsl"/>

Where you want the footer to appear, add:
<xsl:call-template name="footer">
<xsl:with-param name="showSitemap" select="1"/>
</xsl:call-template>


Repeat for other XSLTs that should use the footer, such as page2xhtml-homepage.xsl.

For my publication, I also use common.xsl for a "header" containing the name of the company, the logo, and links to change the language, sign in and out, change to edit mode, and add a favorite to the vistor's profile. The code for all this is somewhat complicated, and development/maintenance is much easier with all of it in one place.

<< Site StructureExternal Links >>

Contact Solprovider
Paul Ercolino