| Kongregate Registration for Free Flash Games and Chat with solprovider | |
![]() |
Displaying a Map of a Publication | |
|
This article creates a page displaying every page on the site, including pages marked "not visible". The instructions create a separate page as the "Sitemap" with the current page marked with an asterisk. The new navigation control "map" could be used as a replacement for the "menu" navigation control, although the asterisk may be undesirable for that purpose. (I would love to use the CSS2 :after content: "*", but I am not certain any browsers support it.)
NOTES1. The term "sitemap" has special meaning for Lenya, so I refer to a sitemap (in the standard web sense) as a "map". This is reflected in the name of the files.2. While {pub} means your publication directory, braces in code are meant to kept. XMAP and XSL files use braces around variables, such as {page-envelope:publication-id} and {$url}, and CSS uses braces around each section. InstructionsThese instructions start from the interface and work down, because I may have forgotten an instruction. Most of my articles start with building the functionality, then add it to the interface. Just skip step 1 until the other steps are completed.While this follows the Lenya paradigm, performance could be improved. On the bad side, the map is created for every page, regardless of whether it is needed. Performance would be better if the Usecase pipeline copied the lenyabody pipeline and replaced every "{4}" with "map". On the good side, any customization of the main pipeline is obeyed. 1. To add a link to the map to your XSL, use: <A HREF="{$url}?lenya.usecase=map"><i18n:text>Sitemap</i18n:text></A>
You may want to read Static Pages for how to avoid showing the link on the map page. 2. Add the map Usecase. NEW FILE: {pub}/usecase-map.xmap <?xml version="1.0" encoding="UTF-8"?>
3. Create the XSLT. NEW FILE: {pub}/xslt/page2xhtml-map.xsl I use the standard XSL for my publication, replacing <xsl:apply-templates select="xhtml:div[@id = 'body']"/>
with: <H2>Sitemap</H2>
4. Add the map navigation element to the standard XMAP. FILE: {pub}/publication-sitemap.xmap FIND: <map:match pattern="lenyabody-*/*/*/*/**">
ADD THIS LINE: <map:part src="cocoon://navigation/{2}/{3}/map/{5}.xml"/>
5. Add the navigation creator. FILE: {pub}\lenya\xslt\navigation\map.xsl <?xml version="1.0" encoding="UTF-8" ?>
CSSI added this CSS to page.css for a neatly spaced and indented red page listing. The key element is left-padding each mapblock. Since each line is a link, color is determined by the mapitem A tags..mapblock {
|