Gerald,

If it is just IE6 you're after, you can use IE conditional comments to
include your css.  Something along the lines of the following should do the
trick:

<!--[if lte IE 6]>
<link rel="stylesheet" type="text/css" href="PATH_TO_CSS/css/ie6.css"
media="screen, projection" />
<![endif]-->

If you are using the STK, you can define add the following code to
templating-kit -> templates -> global -> htmlHeader and look for the line:

[#list model.site.theme.cssFiles as cssFile]
    <link rel="stylesheet" type="text/css" href="${cssFile.link}"
media="${cssFile.media}" />
[/#list]

Modify that to this:

[#list model.site.theme.cssFiles as cssFile]
    [#if cssFile.link?contains("ie6")]
        <!--[if lte IE 6]><link rel="stylesheet" type="text/css"
href="${cssFile.link}" media="${cssFile.media}" /><![endif]-->
    [#else]
        <link rel="stylesheet" type="text/css" href="${cssFile.link}"
media="${cssFile.media}" />
    [/#if]
[/#list]

Make sure you define the css file in your site definition and you should be
good.

Let me know if you have any questions.

Thanks,
Matt



> From: Zdenek Skodik <[email protected]>
> Organization: Magnolia International
> Reply-To: Magnolia User-List <[email protected]>
> Date: Mon, 24 May 2010 13:20:20 +0200
> To: Magnolia User-List <[email protected]>
> Subject: Re: [magnolia-user]  Detecting User-Agent for CSS Switch
> 
> 
> Gerald,
> 
> you can obtain given user-agent from the request, in freemarker with
> something along the lines of
> 
> [#if ${ctx.request.header('User-Agent')}?matches('.*its_id.*')]
> -- include css for appropriate browser
> [/#if]
> 
> or in the model, ...
> 
> -zdenek
> 
> 
> On Mon, 2010-05-24 at 13:14 +0200, Gerald Madlmayr wrote:
>> thanks for the quick replys. Actually I do need something quite simple
>> and don't want to put to much overhead/effort into that.
>> 
>> I have a special CSS for IE6 and I need to include that instead of the
>> CSS I do have for all the other browsers.
>> 
>> If this is somehow possible to implement (easy) in a freemarker template
>> i'd be very happy. thanks.
>> 
>> best, Gerald
>> 
>> Am 23.05.2010 18:24, schrieb Sebastian Frick:
>>> 
>>> WURFL project (http://wurfl.sourceforge.net/) is very powerful
>>> ua-database and provides a Java API for easy integration into Magnolia
>>> as well.
>>> 
>>> Regards,
>>> 
>>> Sebastian
>>> 
>>> 
>>> Gerald Madlmayr schrieb:
>>>> 
>>>> Hi,
>>>> 
>>>> what is actually the best way in Magnolia to detect the user agent of
>>>> the browser in order to include the appropriate CSS/JS Files? Is there
>>>> already an out-of-the box solution?
>>>> 
>>>> Best, Gerald
>>>> 
>>>> ----------------------------------------------------------------
>>>> For list details see
>>>> http://www.magnolia-cms.com/home/community/mailing-lists.html
>>>> To unsubscribe, E-mail to: <[email protected]>
>>>> ----------------------------------------------------------------
>>>> 
>>>> 
>>> 
>>> 
>>> ----------------------------------------------------------------
>>> For list details see
>>> http://www.magnolia-cms.com/home/community/mailing-lists.html
>>> To unsubscribe, E-mail to: <[email protected]>
>>> ----------------------------------------------------------------
>>> 
>> 
>> 
>> ----------------------------------------------------------------
>> For list details see
>> http://www.magnolia-cms.com/home/community/mailing-lists.html
>> To unsubscribe, E-mail to: <[email protected]>
>> ----------------------------------------------------------------
> 
> 
> ----------------------------------------------------------------
> For list details see
> http://www.magnolia-cms.com/home/community/mailing-lists.html
> To unsubscribe, E-mail to: <[email protected]>
> ----------------------------------------------------------------
> 


----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to