forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Turner <je...@apache.org>
Subject Re: Menu questions
Date Fri, 01 Aug 2003 13:25:12 GMT
On Thu, Jul 31, 2003 at 05:32:47PM -0400, Brett Presnell wrote:
> 
> Maybe I shouldn't be using forrest for this project (website for an
> academic department), but anyway ...
> 
> Is it possible to have a page contain a menu without appearing in the
> menu.  What I have in mind is something like the following. Say I have
> 
>   subdir/index.xml
>   subdir/file01.xml
>   subdir/file02.xml
>   ...
>   subdir/file50.xml
> 
> with index.xml containing links to each of the file??.xml.
> 
> I would like to be able to click on the link to file01.html and have
> it come up basically with the same menu and tabs that I see when I'm
> viewing index.html.  I thought this might just happen automatically
> ifI left all the file??.xml's out of site.xml, but it doesn't.  I've
> tried all kinds of contortions with site.xml and tabs.xml (using a CVS
> version of Forrest from within the last 24 hours), but I can't manage
> to make it happen.
> 
> Anyway, if it's not possible, that's ok.  If it is, how do I make it
> work?

Anything is possible, given enough tinkering with the sitemaps.

How does this look:

http://cvs.apache.org/~jefft/forrest/samples/hidden-menus-site/

It's a modified 'forrest seed' site, where page[1-5].html pages have a
customized menu, showing their page*.html peers and index.html 'parent';
for example:

http://cvs.apache.org/~jefft/forrest/samples/hidden-menus-site/page1.html

Is this more or less what you're after?

The webapp source available at:

http://cvs.apache.org/~jefft/forrest/samples/hidden-menus.tgz

The custom menu for page*.html pages was done by adding an extra matcher
to sitemap.xmap, just before the default **book-*.html matcher:

      302       <!-- ADDED -->
      303       <map:match pattern="**book-page*.html">
      304         <map:generate src="content/xdocs/book-index.xml"/>
      305         <map:serialize type="xml"/>
      306       </map:match>
      307       <!-- /ADDED -->
      308 
      309       <map:match pattern="**book-*.html">
      310         <map:mount uri-prefix="" src="menu.xmap" check-reload="yes" />  
      311       </map:match>
      312 

Where book-index.xml is just a saved copy of XML from URL
book-index.html, modified to include the extra menu items.

A few auxiliary changes were also needed:

 - In forrest.properties, I had to exclude book-index.xml from
   validation:
     forrest.validate.xdocs.excludes=site.xml,book-index.xml

 - By default, the forrest-site skin's book2menu.xsl treated the
   'index.html' link as a menu, and therefore not clickable.  I overrode
   the book2menu.xsl stylesheet to make any element with a href attribute
   clickable:

--- /home/jeff/apache/xml/xml-forrest/src/resources/skins/forrest-site/xslt/html/book2menu.xsl
 2003-03-26 23:55:07.000000000 +1100
+++ src/documentation/skins/forrest-site/xslt/html/book2menu.xsl    2003-08-01 23:03:24.000000000
+1000
@@ -18,7 +18,12 @@

   <xsl:template match="menu">
     <li>
-      <font color="#CFDCED"><xsl:value-of select="@label"/></font>
+      <xsl:if test="@href and not(contains(@href, '/'))">
+        <a href="{@href}"><xsl:value-of select="@label"/></a>
+      </xsl:if>
+      <xsl:if test="not(@href)">
+        <font color="#CFDCED"><xsl:value-of select="@label"/></font>
+      </xsl:if>
       <ul>
         <xsl:apply-templates/>
       </ul>


--Jeff

> -- 
> Brett Presnell
> Department of Statistics
> University of Florida
> http://www.stat.ufl.edu/~presnell/
> 
> "We don't think that the popularity of an error makes it the truth."
>    -- Richard Stallman

Mime
View raw message