[opencms-dev] Load templates dynamically
Mario Jäger
m.jaeger at alkacon.com
Wed Jul 6 12:42:31 CEST 2011
Hi,
One correction to 3): In the <cms:device> tag example the type attribute
is set to "mobile" instead of "ipod":
<cms:device type="mobile">
...
</cms:device>
Kind Regards,
Mario.
Am 06.07.2011 12:31, schrieb Mario Jäger:
> Hi,
>
> Overall, your procedure to include a template dynamically is right. But,
> the following remarks:
>
> 1) Using OpenCms templates in the right procedure would also use the
> "element" attribute in the<cms:include> tag, like:
>
> <cms:include ... element="head"/>
>
> and
>
> <cms:include ... element="foot"/>
>
> Do you know the procedure to split the template jsp into elements using
> the<cms:template> tag?
>
> 2) Instead of hard coding the template files in the jsp, you also could
> use the "template" property. And for example, you could create your own
> second template property for the other user agent, like
> "template_mobile". Then, regarding the remark in (1) you could include
> the template for the other user agent in that way:
>
> <cms:include property="template_mobile" element="head" cacheable="false"/>
>
> The advantage is, that you only need to change the property to change a
> template. And that you can use another template for special subfolders.
>
> 3) Since OpenCms V8 there is the<cms:device> tag. With that tag you get
> the device where the page is called from. Code inside that tag is only
> executed for the configured device in the "type" attribute. As example
> using that tag for the device "iPod":
>
> <cms:device type="ipod">
> ...
> </cms:device>
>
> Unfortunately, the iPad is still not supported by that tag.
>
> If you use that tag in the template jsp, you only need one template jsp
> then.
>
> Kind Regards,
> Mario.
>
>
>
> Am 06.07.2011 05:43, schrieb Daniel:
>> Choose different template file base on user agent.
>>
>> <%
>> String ua = request.getHeader("User-Agent");
>> if(ua.indexOf("iPod")> 0 || ua.indexOf("iPad")> 0 ){
>> %>
>> <cms:include file="index-html5.jsp" cacheable="false" />
>> <%}else{%>
>> <cms:include file="index-flash.jsp" cacheable="false" />
>> <%}%>
>>
>>
>> 2011/7/5 Mario Jäger<m.jaeger at alkacon.com<mailto:m.jaeger at alkacon.com>>
>>
>> Hi,
>>
>> I am not sure if I understand your question right. Using the "template"
>> property you can set a template quite dynamically.
>>
>> Kind Regards,
>> Mario.
>>
>>
>>
>> Am 16.06.2011 11:04, schrieb R. Jonyo:
>> >
>> > Any one knows how to load templates dynamically on JSP?
>>
>>
>> --
>> -------------------
>> Mario Jäger
>>
>> Alkacon Software GmbH - The OpenCms Experts
>> http://www.alkacon.com - http://www.opencms.org
>>
>> _______________________________________________
>> 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
>>
>>
>>
>>
>>
>> _______________________________________________
>> 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
>
>
--
-------------------
Mario Jäger
Alkacon Software GmbH - The OpenCms Experts
http://www.alkacon.com - http://www.opencms.org
More information about the opencms-dev
mailing list