cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorsten Scherler <thors...@apache.org>
Subject Re: AW: AW: AW: AW: Design note - Building a template mechanism
Date Fri, 08 Apr 2005 00:21:55 GMT
Hi,

I had a look on the wiki page you posted http://wiki.apache.org/cocoon/TemplateBasedWebSite
and it gave me some really good
ideas for the view plugin I am working on in forrest.

http://svn.apache.org/viewcvs.cgi/forrest/trunk/plugins/org.apache.forrest.plugin.view/?rev=160476
http://svn.apache.org/viewcvs.cgi/forrest/trunk/plugins/org.apache.forrest.plugin.leather/?rev=160476

Together with another plugin (right now called leather but will be
renamed to ViewHelper) it is following the DispatcherView pattern
http://java.sun.com/j2ee/patterns/DispatcherView.html and building a
unit.

I am using right now a different approach then you but it seems we are
trying to solve the same problem.

Have a look at
http://svn.apache.org/viewcvs.cgi/forrest/trunk/plugins/org.apache.forrest.plugin.view/src/documentation/default.fv?view=markup

That is a view on a site. The link is the default view for the site but
you can define a new view for each page of your webapp.

A view basically contains three tags (for now - it is in a really early
stage):
<forrest:view
  xmlns:forrest="http://apache.org/forrest/templates/1.0" type="xhtml">
  <forrest:contract name="meta"/>
  <forrest:hook name="container">
   <forrest:contract name="feedback"/>
  </forrest:hook />
</forrest:view>

The view tag's @type determines the final output format. The idea is to
configure different output formats via a view. That is the biggest
different to your approach.

Each forrest:hook will be transformed into a <div/> tag (in html
output). This tags are designed to help web-designers to freely move
around and group contracts into design container.

Each forrest:contract will dispatch a xml file (ViewHelper) that contains
xsl:stylesheets for the different output formats, a contract can
implement. For html, the only format that I have implemented so far, we
have three different kind of templates:

<xsl:templates name="{contract/@name}-css/>
Here the contract specific css will be stored.

<xsl:templates name="{contract/@name}-head/>
Here goes everything that belongs in the html head. e.g. scripts.

<xsl:templates name="{contract/@name}-body/>
Everything that belongs into the body.

e.g.
http://svn.apache.org/viewcvs.cgi/forrest/trunk/plugins/org.apache.forrest.plugin.leather/resources/templates/fontsize.ft?view=markup


The view follows exactly the pattern shown here: 
http://corej2eepatterns.com/Patterns2ndEd/DispatcherView.htm
Right now it is implemented for the forrest way of producing the models
for the view but I am planing to create independent BusinessHelper to
access all BusinessServices you may have in your application.
e.g. http://svn.apache.org/viewcvs.cgi/forrest/trunk/plugins/org.apache.forrest.plugin.leather/resources/templates/feedback.ft?view=markup

shows that the $config has to be in the presentation model. Right now there are only forrest
core BusinessHelper.

One workaround is
http://svn.apache.org/viewcvs.cgi/forrest/trunk/plugins/org.apache.forrest.plugin.leather/resources/templates/feedback-dyn.ft?rev=159861&view=markup
where I pass the models via <xsl:param name="main"/> into the ViewHelper. That 

salu2
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


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


Mime
View raw message