[opencms-dev] View page with 2 different templates
Yves Glodt
yg at mind.lu
Mon Mar 15 14:36:21 CET 2010
Actually, after a long time I came up with a solution to this...
Use a "controller-template", and according to a parameter (e.g. the
user-agent), load the relevant template:
The "controller-template" could look like this:
<%@ page session="true" %>
<%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<c:choose>
<c:when test="${fn:contains(header['User-Agent'], 'Android')}">
<cms:include page="/templateMobile.jsp" />
</c:when>
<c:otherwise>
<cms:include page="/templateFull.jsp" />
</c:otherwise>
</c:choose>
best regards,
Yves
On 11 March 2008 10:25, Yves Glodt <yg at mind.lu> wrote:
> On Tuesday 11 March 2008, Marwedel Frank wrote:
>> Hello Yves
>
> Hello Frank,
>
>> Normally this is realized with two different stylesheets, look for
>> stylesheets for different media.
>
> I am aware of the different stylesheets for print and mobile etc.
>
> But in my case I wanted to get the knowledge of how to work with a separate
> template for printing, and also for mobile clients, which will produce less
> html and include less images and css. Is that recommended or not?
>
> I could also do it with if/else orgies, but I prefer to create a different
> template, than having one large...
>
> Best regards, Liebe Grüsse,
> Yves
>
>> So you can use the same template and you
>> can have totally different views. You can see this on the opencms homepage.
>> Bye,
>> Frank
>> _______________________________
>> Dipl.-Biol.
>> Frank Marwedel
>> Development Services
>> Senior Consultant
>> SYCOR GmbH
>> Heinrich-von-Stephan-Straße 1-5
>> D - 37073 Göttingen
>> Telefon +49 551 490 2943
>> Telefax +49 551 490 23 2943
>> Mobil +49 175 7214760
>> Frank.Marwedel at sycor.de
>> www.sycor.de
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
>
More information about the opencms-dev
mailing list