loading a different site-colors.css for different user groups

Author Message

Andy Woods

Thursday 14 April 2011 2:41:18 am

Hi,

I'm developing a site for children aged between 5 and 18.

I will be allocating children aged between 5 and 12 to one user group and those over 12 to another user group.

I'd like to display a different skin to each user group. I was planning on doing this by loading a different site-colors.css for each group.

Can you tell me if this is possible and how I would do it?

Thanks,

Andy

Manuel Koch

Thursday 14 April 2011 8:26:32 am

Hi

You can do something like this in your hmtl <HEAD></HEAD>

________________________________

{def $user=fetch( 'user', 'current_user' )}

{if $user.groups|contains(12)}

<link rel="stylesheet" type="text/css" href="css2.css" />

{elseif $user.groups|contains(2)}

<link rel="stylesheet" type="text/css" href="css3.css" />

{else}

<link rel="stylesheet" type="text/css" href="css1.css" />

{/if}

_________________________________

Note: The Numbers 2/12 in the contains() operator are placeholders

Greats

Andy Woods

Thursday 14 April 2011 11:15:06 am

Hi Manuel,

Thank you for your help.

Do the numbers '12' and '2' relate to the Node ID of the User Groups?

Andy

Manuel Koch

Friday 15 April 2011 1:15:58 am

Hi Andy

Yes you can show the added groups of a user with

{foreach $user.groups as $group}

{$group},

{/foreach}

Manu

Andy Woods

Saturday 16 April 2011 4:46:09 am

Thanks for your help Manuel.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.