View Full Version : Themes
bobmanc
Aug 28th, 2004, 01:14 PM
What are themes? Are they supposed to implement something like sitemesh? Are they currently working?
gmatthews
Aug 31st, 2004, 12:35 AM
yep.
here's what seems to be the minimum to get them going, based on my slightly hit and miss approach.
1. setup handlerMapping, themeInterceptor and themeResolver in *-servlet.xml
<bean id="handlerMapping" class="org.springframework.web.servlet.handler.BeanNameUr lHandlerMapping">
<property name="interceptors">
<list>
<ref local="themeChangeInterceptor"/>
</list>
</property>
</bean>
<bean id="themeResolver" class="org.springframework.web.servlet.theme.SessionTheme Resolver"/>
<bean id="themeChangeInterceptor" class="org.springframework.web.servlet.theme.ThemeChangeI nterceptor"/>
2. setup messageSource to determine at a minimum any themes you have. In this case, 'dev' and 'theme' are themes. 'theme' seems to be the default theme name.
<bean id="messageSource"
class="org.springframework.context.support.ReloadableReso urceBundleMessageSource">
<property name="basenames">
<list>
<value>WEB-INF/usermessages</value>
<value>WEB-INF/dbmessages</value>
<value>WEB-INF/label</value>
<value>WEB-INF/dev</value>
<value>WEB-INF/theme</value>
</list>
</property>
</bean>
3. create properties files referenced in messageResource, e.g. classes/dev.properties. The 'css' property in this file will be used to construct a link reference in your JSP page.
css=/themes/dev/style.css
4. plug theme/CSS resolving into your JSP
<c:set var="css"><spring:theme code="css"/></c:set>
<c:if test="${not empty css}">
<link rel="stylesheet" href="<c:url value='${css}'/>" type="text/css" />
</c:if>
5. put buttons or whatever on jsp page to switch themes, where dev and theme below seem to correspond to the property files referenced in step 2.
<input type="submit" name="theme" value="dev"/>
<input type="submit" name="theme" value="theme"/>
fester
Sep 8th, 2004, 10:47 AM
Hopefully the documentation will talk about this soon. "Dummy Paragraph" does not do much good.
steven.warren
Sep 8th, 2004, 01:01 PM
I think sitemesh and themes are completely different things. Themes allow you to include in a web page "theme" specific stuff (for example, you could have several different gif files for a logo, a different gif for each "theme").
sitemesh, on the other hand, extracts sections of html out of a source web page and embeds that html in another page. This allows you to build wrappers, or "decorators" for basic content-only oriented web pages (which may contain "theme" specific data).
bobmanc
Sep 8th, 2004, 01:44 PM
I agree. I'm not even sure about the images. It may be just a way to associate a stylesheet with a user.
derrickhackman
Aug 10th, 2005, 01:02 PM
I found the same lack of documentation issue and if I didn't find this post I would still be up a creek without a paddle. Thanks for the most excellent post.
Cheers.
tomek_k
Jan 19th, 2006, 02:32 PM
any help on using themes with velocity? can't find anything on that topic :(
thanks for any advice
Tomek
Powered by vBulletin® Version 4.2.1 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.