cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <Ralph.Go...@dslextreme.com>
Subject Re: [RT] composition vs. inheritance in blocks
Date Wed, 30 Mar 2005 23:11:10 GMT
Daniel Fagerstrom wrote:

> Ok, I'll give you a new example trying to explain the concept. Let's 
> start with the portal block and say that I want to use that for my 
> app, MyPortal, but I want a different skin. The skin consists of the 
> stylesheet "styles/portal-page.xsl" among other things. We assume that 
> the designer of the portal block wanted to make the skin overridable 
> so there is a sitemap rule that exposes the stylesheet in the Portal 
> block.
>
> <match pattern="styles/portal-page.xsl">
>   <read src="default-portal-page.xsl"/>
> </match>
>
> Now I let MyPortal extends Portal and reimplements the stylesheet in 
> MyPortal
>
> <match pattern="styles/portal-page.xsl">
>   <read src="my-portal-page.xsl"/>
> </match>
>
> and thanks to polymorphism the user of MyPortal will get 
> "my-portal-page.xsl" when asking for "styles/portal-page.xsl" and 
> everything else will be delivered from Portal.

Normally, I try to avoid these "theoretical" posts, but since you are 
picking on the portal...  Frankly, if the way you are proposing this was 
actually how the portal worked we would not be using it.  Luckily, to do 
what you are suggesting is as simply as doing something like:

<map:match pattern="styles/portal-page.xsl">
  <map:read 
src="{globalConfig:/global-variables/skin}styles/portal-page.xsl"/>
</map:match>

I understand you were trying to make a point, but sometimes I feel like 
these diatribes resort to using a sledgehammer where a simple 
screwdriver would do the job nicely.

Ralph


Mime
View raw message