David Crossley wrote:
Paul Bolger wrote:
- A simple, intuitive way for non-XMLers to add things to site.xml
Have you any suggestions about what this may look like?
Not sure how technically possible this is, but how about a directory
parser which builds the site nav? In other words the user would create
a directory structure, arrange their source files where they want them
to appear in the site map, and the parser would build the site
structure in site.xml as a mirror of that directory structure.
I realise that this would sacrifice flexibility, but I think a lot of
users would use a 'quick and dirty' site design method (particularly
one where rejigging the site structure would be as simple as moving
the source files).
I've implemented this in a few different ways but never been totally
happy with the results. The problem is in a dynamic environment where
caching seems to get in the way, for a static site they qork well.
Because I'm not happy with them they remain undocumented. If someone
were to play with them an improve them it would be great.
One of my experiments was reasonable succesfull and is in SVN:
Directory Reader
================
This is almost exactly what you describe. You can see it in the Resume
plugin in whiteboard. In particular:
<map:match pattern="team/all.source.xml">
<map:generate type="directory"
src="{project:content.xdocs}/team/resume">
<map:parameter name="include" value=".*.xml$"/>
</map:generate>
<map:transform src="resources/stylesheets/directory2resumes.xsl"/>
<map:transform type="cinclude"/>
<map:serialize type="xml"/>
</map:match>
<map:match pattern="resume.site.snippet.xml">
<map:generate src="cocoon:/team/all.source.xml"/>
<map:transform
src="resources/stylesheets/resumes2resumeSiteSnippet.xsl"/>
<map:serialize type="xml"/>
</map:match>
Now just add a cinclude to site.xml for the "resume.site.snippet.xml"
and you get an index of all resumes in the /team/resume directory.
The main problem with this is that the resumes have to go in a specified
directory - not flexible, as you observe, but very easy to use.
Since writing that plugin we have made the locationmap actually work, we
now have a level of flexibility over the location of the files we want
to generate an index for without having to touch the plugin sitemap. So
this approach can be improved considerably now.
Ross