cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Derek Hohls" <DHo...@csir.co.za>
Subject RE: Separation of Concerns (presentation elements)
Date Mon, 22 Apr 2002 14:24:42 GMT
Paul

FWIW, my opionion is it seems that including the page layout in the
page
is pretty much what Cocoon is designed to avoid in the first place!!
(ie.
separation of concerns - see the various Cocoon documents discussing
why this is a "good thing" and what advantages it offers...)

That's why Andreas' appraoch is neat - I was able to adapt it to help
me 
manage a *real* website - and simply by moving a file and changing one

entry in the  site.xml file, was able to show a page with a whole new
look 
and feel.

YMMV
Derek

>>> Ricardo.Trindade@myrealbox.com 20/04/2002 07:46:15 >>>
where can I find that tutorial ? I checked all the cocoon docs and
didn't
find it.
are there any other resources ?

thanks
Ricardo Trindade

-----Original Message-----
From: Paul Pattison [mailto:paul@76design.com] 
Sent: sexta-feira, 19 de Abril de 2002 18:43
To: Cocoon Mailing List
Subject: Separation of Concerns (presentation elements)


Hi everyone,

I had a brief stint where I used Jakarta's Turbine project.  One of
the
things that I really liked about it was that it divided a page's
presentation elements into a bunch of separate files
(navigation,content,layout,etc).

I guess it didn't really sink in that I could do all that with Cocoon
until
a few days ago when I read Andreas Hartmann's 'Creating a Navigation
Menu'
tutorial.  I thought this was an excellent tutorial!

The one thing that I wanted to change was the fact that in that
tutorial, he
uses a cryptic url pattern to give the sitemap parameters for what
section
and style a page should have.  I would prefer to use an ordinary
convention
(ie just *.html).  With Turbine, a 'layout' for example was set by
calling
the 'setLayoutTemplate("/PrintableLayout.vm")' method at the top of a
page.
I really liked how the layout was defined as a part of the page.  So
for my
Cocoon page I wanted to have something like this:

<page>
  <layout>homepage.xsl</layout>
   <!-- <DEFANGED_STYLE>simple-page2html.xsl --> </DEFANGED_STYLE>
  <content>foo</content>
</page>

A 'layout' describes the structure of the page.  This means where the
content, navigation, header and footer go.  A 'style' describes the
look of
the content.

But I couldn't figure out how to get these values to the sitemap so
that it
could chose the appropriate .xsl files.  Then today I took a stab at
understanding Actions better and it seems to me like this is the
approach I
need.  I should create an action that would open my page read the
values of
the tags requested and return their values.  I figured I could create
this
generic enough that it could be used to read any tag values in any
specified
xml document and be used for other purposes.

So here's what my sitemap would include:

<map:match pattern="*.html">
  <map:act type="param-fetcher">
    <!-- page to get values from -->
    <map:parameter name="filename" value="{1}.xml"/>
    <!-- tags to get values from -->
    <map:parameter name="tags" value="style,layout"/>

    <map:generate type="file" src="documents/{1}.xml"/>
    <map:transform src="stylesheets/{style}-html.xsl"/>
    <map:transform src="layouts/{layout}.xsl"/>
    <map:serialize type="html"/>
  </map:act>
</map:match>

Before I wrote the Action I wanted to see what people thought of this
approach.  Is it a good idea?  Is it something that would be helpful to
have
as an included Action?  Is there a better way of doing it?

Wow, this was a long email.  If you made it through the whole thing and
have
some feedback for me that would be GREAT!!  Thanks in advance.

Paul


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>



---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message