You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by Thorsten Scherler <th...@apache.org> on 2006/02/02 19:08:45 UTC

Re: Best way to add repeatable code in v2/v3 (was Re: Example usecase)

El lun, 30-01-2006 a las 16:06 +0800, Gav.... escribió:

...
> 
> 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/{1}.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/getRequest}.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 then you have to split the stuff that changes apart from the static
content.

> 
> So this custom business service 'sounds' like what I need, just I can't
> see how to implement it.

Ok, to find out:
Do your sponsored pages follow some rule? I mean on page xy there is
always sponsor z, or a similar rule. Or are this sponsor link
dynamically and will change even after a refresh of the site?

> 
> Does anyone have any ideas on the how ?

Actually it is all a little bit further on the top. 

salu2
-- 
thorsten

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