After further thought & experimentation I think the best solution is to do
the same as for the i18n support, i.e. URL prefixing. So my one site that
has a page called http://www.whatever.com/magnolia/hello.html can be
referenced by http://www.whatever.com/magnolia/<themename>/hello.html. The
context will have the theme name set in it and so the template can do
whatever it needs to do.

I worked out what needs to be done by looking at how I18n is done in 3.6.1.
I have to say that I am very impressed so far with the quality of your code
& layout - made working out what to do quite painless. Next step is to work
out how to config my new stuff the same you do from the JCR using your
factory code.

I also like the amount of unit tests you have - really helps when
refactoring.

I've done a proof of concept that involves a filter to remove the theme and
set it in the context and modified the simplenavigation JSP tag to rewrite
the URL. I also see I need to do the same when resolving the UUID to a URL.
Are there any other areas I need to worry about ?

And would it be worth adding hooks to Magnolia for this type of thing in the
future ? So for example a module writer could add callbacks that are invoked
when URIs are rewritten ? The code I've written essentially forks the code
base for now - I can't see an easy way to do this work any other way.

Jon.

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] 
Sent: 07 August 2008 16:25
To: [email protected]
Subject: Re: [magnolia-user] How to display 2 themed sites from one content
tree

It is a good idea...

The code can be something like this: 

http://www.mysite.com/page.theme1.jsp
http://www.mysite.com/page.theme2.jsp


--- jsp ---
<[EMAIL PROTECTED] import="info.magnolia.cms.util.Resource"%>

<%
String themeSelector = Resource.getSelector();  // themeSelector will be =
"theme1" or "theme2" 
%>

Now you can reference for instance a completely different css, using
themeSelector as folder name of your css resources...so that you can realize
a "skin".

Otherwise, with simple if statements you can drive the content you want...


Hope it helps..

Matteo




-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] 
Sent: giovedì, 7. agosto 2008 15:06
To: [email protected]
Subject: Re: [magnolia-user] How to display 2 themed sites from one content
tree

I remember vaguely having used once a methode where you ad a  
discriminator between the filename and the file extension.

http://www.magnolia.info/home.html
http://www.magnolia.info/home.foo.html
http://www.magnolia.info/home.bar.html

result in the same page. But you can catch the discriminator (in this  
case "test") and act upon it. Both pages will get cached propperly if  
I remember correctly. Unfortunately I don't have the code by hand  
right now. But I hope this gives you an idea.

Cheers,
Will

On 07.08.2008, at 14:48, Jon Barber wrote:

> Hi,
>
> I'd like to use Magnolia to serve one web site with 2 themes using
> magnolia. The themes will consist of different content for the top and
> right hand bar, but the site structure will be exactly the same, and  
> the
> content for the main panel will be identical. I need to make use of  
> the
> caching capability of magnolia, and new pages need to be added to
> certain sections. I'd like to have just the one site structure within
> the website view.
>
> What's the best way to do this so that adding new content will be
> visible on both themes as painlessly as possible ? I'm very  
> comfortable
> with JSP scripting and writing Java code, but I'd like to avoid doing
> custom work if need be.
>
> My current thinking is to use a scheme similar the I18n support using
> URL prefixing. So for example, say the two themes are foo and bar, the
> URLs would be http://somewhere.com/foo/index.html and
> http://somewhere.com/bar/index.html. I'd write a filter to extract the
> prefix and place it in the request context so that the page knows  
> which
> theme to use. This would mean some custom work though.
>
> It looks like virtual URIs might be able to help, or maybe even
> sub-templates ?
>
> Any help much appreciated.
>
> Thanks,
>
> Jon.
>
> ----------------------------------------------------------------
> for list details see
> http://documentation.magnolia.info/
> ----------------------------------------------------------------


----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/
----------------------------------------------------------------

----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/
----------------------------------------------------------------


----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/
----------------------------------------------------------------

Reply via email to