----- Original Message -----
From: "Thorsten Scherler" <thorsten apache.org>
To: <dev forrest.apache.org>
Sent: Monday, January 23, 2006 1:19 AM
Subject: Re: Best way to add repeatable code in v2/v3 (was
Re: Example
usecase)
<snip>
|
| <forrest:contract
name="content-include-html">
| <forrest:properties
contract="content-include-html">
| <forrest:property
name="content-include-html"
| nugget="get.nugget.include.html">
| <jx:import
uri="cocoon://includes.rightbar.html"/>
| </forrest:property>
| </forrest:properties>
| </forrest:contract>
|
| ...but be aware that this contract expect a <div
id="content"/>:
| <xsl:copy-of
select="$content-include-html//div[ id='content']/*"/>
As I said in another mail, I could not get this to work, but
doesn't
matter now anyway, thought I'd mention it in case the
problem
was was also a sympton for something else.
|
| > Alternative I thought of would be to create a
contract for it. Although
I
| > can see how to
| > create a contract, not sure again on the best way of
approaching it.
Maybe
| > doing a similar
| > thing as including the body from say index.xml but
using
| > rightnavcontent.xml, use jx: ??
| >
|
| Actually I think in your case it would makes sense to
create a contract.
|
| Now you have different options to implement it.
|
| 1) controlled by the structurer
| You can use the genericMarkup.ft
| <forrest:contract name="genericMarkup">
| <forrest:properties
contract="genericMarkup">
| <forrest:property name="genericMarkup">
| <div class="rightsub">
| <h5>Sponsor This Site!</h5>
| </div>
| </forrest:property>
| </forrest:properties>
| </forrest:contract>
|
| You would do this if the code is added to all pages and
actually does
| not change too much.
I have done this and works fine, http://apache.minitu
torials.com/ is
updated.
As soon as you change it on a regular basis and
| would need to have different code on different pages it
makes sense to
|
| 2) create a custom business service
| A custom business service is an extension of forrest core
data models.
| In the dataModel.xmap you can find the core models. You
can add your own
| service to your project sitemap. Like:
| <map:match
pattern="includes.rightbar.**.xml">
| <map:generate
src="{project:resources}/includes/rightbar/.xml"
; />
| <map:serialize type="xml"/>
| </map:match>
|
| This assumes that you move to xml instead of html output
(remember you
| can use html like grammar in xml).
|
| Now you could define the contract like:
| <forrest:contract
name="content-include-rightbar">
| <forrest:properties
contract="content-include-rightbar">
| <forrest:property
name="content-include-rightbar"
| nugget="get.nugget.include.rightbar">
| <jx:import
|
uri="cocoon://includes.rightbar.#{$cocoon/parameters/ge
tRequest}.xml"/>
| </forrest:property>
| </forrest:properties>
| </forrest:contract>
|
| and the contract:
| <xsl:template
name="content-include-rightbar-body" >
| <xsl:param
name="content-include-rightbar"/>
| <xsl:copy-of
|
select="$content-include-rightbar/*"/>
| </xsl:template>
I have been looking at this only in them email and not tried
yet
to implement it. I just can not see at the moment how to use
this
to apply slightly varying content to different pages.
For instance, look at the right hand side of
http://www.minitutorials.com/apache/apacheindex.shtml.
There is a 'This page sponsored by' div and then below it is
another
div with the sponsor image and info. This div is the only
div that will be
different on all pages. Everything else on the right hand
side will be
exactly the same for the whole site.
So this custom business service 'sounds' like what I need,
just I can't
see how to implement it.
Does anyone have any ideas on the how ?
Thorsten, I know you have a real work-load on, so just say
'too busy'
if you like and I'll look a bit deeper into it myself.
Thanks
Gav...
| HTH
| salu2
| --
| thorsten
|
| "Together we stand, divided we fall!"
| Hey you (Pink Floyd)
|
|
|
|
| --
| No virus found in this incoming message.
| Checked by AVG Free Edition.
| Version: 7.1.375 / Virus Database: 267.14.21/236 - Release
Date:
20/01/2006
|
|
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.14.23/243 - Release
Date: 27/01/2006
|