css theming
japanitrat - August 1, 2008 - 05:13
| Project: | User Activity |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | sanduhrs |
| Status: | closed |
Jump to:
Description
I just wanted to alter the default output, but found that every style is defined inline, so no real opportunities to theme the user-activity via the theme's css file.
As I've read, this is only possible via theme-functions.
So I like to suggest that you make a module css file which defines the non-changing styles for user-activity-elements. (like background/heights/paddings/etc. for instance)
thx for reading :)

#1
There are four themeable functions defined for user_activity.
You may change the complete output as follows:
Copy the desired theme function from the module, eg:
function theme_user_activity_o_meter($index) {
$output = '
<div class="user_activity_o_meter" style="width:100%;height:20px;background-color:#C3D9FF;">
<div style="width:'. sprintf("%01.0f", $index) .'%;height:20px;background-color:#6BBA70;color:white;text-align:center;"></div>
<div style="margin-top:-20px;text-align:center;">'. sprintf("%01.2f", $index) .'%</div>
</div>';
return $output;
}
to template.php file in your theme's directory (simply create the file, if it does not exist), and rename the function to:
function phptemplate_user_activity_o_meter($index) {}or
function YOURTHEMENAME_user_activity_o_meter($index) {}you may then change the output to your likings, e.g.:
function phptemplate_user_activity_o_meter($index) {
$output = '
<div class="user_activity_o_meter">
<div style="width:'. sprintf("%01.0f", $index) .'%;"></div>
<div>'. sprintf("%01.2f", $index) .'%</div>
</div>';
return $output;
}
I don't like inline styles, too. But there's no way around it, as the width of the bar must be generated on the fly. And there's no clean way - I know of - to do this in external css files.
Anyway, I exluded all none vital styles into an external css file.
Hope that helps.
Commited to 5,6,HEAD.
Thanks.
#2
Automatically closed -- issue fixed for two weeks with no activity.