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.

eZ debug

Timing: Jan 29 2025 23:49:35
Script start
Timing: Jan 29 2025 23:49:35
Module start 'layout'
Timing: Jan 29 2025 23:49:35
Module start 'content'
Timing: Jan 29 2025 23:49:35
Module end 'content'
Timing: Jan 29 2025 23:49:35
Script end

Main resources:

Total runtime0.0156 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0053 588.3906151.2422
Module start 'layout' 0.00530.0026 739.632836.7188
Module start 'content' 0.00790.0061 776.351690.0313
Module end 'content' 0.01400.0016 866.382833.9766
Script end 0.0156  900.3594 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002415.3231140.0002
Check MTime0.00117.1109140.0001
Mysql Total
Database connection0.00074.402010.0007
Mysqli_queries0.002918.385930.0010
Looping result0.00000.064110.0000
Template Total0.00106.710.0010
Template load0.00085.265310.0008
Template processing0.00021.375810.0002
Override
Cache load0.00063.781210.0006
General
dbfile0.00031.621480.0000
String conversion0.00000.051940.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs