Thanks Antonio, we looked at Dimisions but found the simple implementation below would suffice.

I'll share the details and welcome any comments or criticisms.

1. The session includes a unique key that identifies the current theme.
2. We implement our own DefinitionsFactory that decorates the default DefinitionsFactory impl (UrlDefinitionsFactory).
3. We adopt a naming convention for tiles that incorporates the theme name.
eg. the default tile is "account.home".  The themed tile is "companyA.account.home"

4. Within the new definitions factory, the getDefinition method checks if there's a theme defined in the session.  If a theme exists, it check to see if there is a theme-specific tile defined for the requested name and returns that if it does, otherwise the default implemntation is called.

eg. a call to getDefinition("account.home", tilesContext) within the customerA theme returns the "customerA.account.home" tile.

Requests for theme specific tiles are passed straight through to the default impl.  eg. getDefinition("customerA.account.home.intro", tilesContext)

Works a treat.  Using this approach we can add new theme tiles without affecting existing tiles, or with refactoring isolated only to the affected tiles. Also in order to add avoid a monolithic definitions file we add any tiles-<theme>.xml files as definition sources.

regards,
Jeromy Evans

Antonio Petrelli wrote:
2007/8/24, Jeromy Evans <[EMAIL PROTECTED]>:
  
Hi guys,

I was just wondering if there's any standard practice or suggestions for
how Tiles 2 can be used for rebranding/customizing a website.

One of my clients has a single website with many large customers that
require subtle (and sometimes significant) changes to certain pages in
order to win the contract with them (not my decision).  The site already
incorporates themes through templates and css based on a session
attribute, but this problem is more oriented towards once-off functional
changes specific for each customer.

Example:
After their user logs in, the home page includes a form that integrates
to their external site, specialised text and links to some new pages
that include their exclusive functionality. Some irrelevant tiles are
replaced or removed.

It comes up quite frequently and the existing conditional logic is
getting a little out of hand.

I was toying with a few approaches, but thought I should put the
question out there to see what the community has already come up with
within the Tiles context.
    

You could take a look to Dimensions: the port to Tiles 2 is in the SVN
trunk, but it should work.
http://mutidimensions.sourceforge.net/

Antonio



  

Reply via email to