CSS theme the drigg node list based on the "action" : upcoming, archive & popular
PGiro - October 13, 2008 - 11:16
| Project: | Drigg |
| Version: | 6.x-1.x-dev |
| Component: | User interface |
| Category: | feature request |
| Priority: | normal |
| Assigned: | philbar |
| Status: | needs work |
Description
Hi,
I want to have a different background color for my node lists depending on whether the user is displaying "upcoming" or "popular". I haven't found a way to do that with the current way things are done : there is, as far as I can tell, no difference in display both lists, only the data is different.
I suppose a simple solution would be to encpasulate the list of nodes created in drigg_ui_node_list() with a div holding the action sort of like this:
$output = '<div class="'.$action.'">'; // ADD DIV HERE
// How many items to be shown in each page?
if(variable_get('drigg_hide_archived_menu',FALSE) && $action == 'archived'){
$items_per_page=150;
} else {
$items_per_page=variable_get('drigg_items_in_main_page', 20);
}
// Scan through the results
$result = pager_query(db_rewrite_sql($query), $items_per_page,0,NULL,$query_vars);
if (db_num_rows($result)==0) {
drupal_set_message(t(variable_get('drigg_no_items_to_display', 'No scoop available!')));
} else {
while ($node = db_fetch_object($result)) {
if($action == 'archived' && variable_get('drigg_hide_archived_menu', FALSE)){
$output .= '<p> '.l($node->title,'node/'.$node->nid).'</p>';
} else {
$output .= node_view(node_load($node->nid), TRUE);
}
}
}
$output .= theme('pager', NULL, variable_get('drigg_items_in_main_page', 20), 0);
$output .= "</div>"; //END DIV HEREThen I can theme based on the containing class
What are your thoughts ? Any better way ?

#1
#2
Hi,
You are totally right, I think there should be a div around them.
Are you able to code?
I am especially interested to know if the default theme breaks if we add the divs. Can you give it a try and let me know?
If nothing gets broken, I shall add the div!
Merc.
#3
Sure.
I've attached a patch against drigg_ui.module version 1.35. You need to apply the patch directly in the drigg_ui directory.
I've tested it on the stock drigg theme and it works fine, can someone else test it ?
Philippe
aka watcherFR (changed my nick...)
#4
Hi,
Anybody else: please test it?
Merc.
#5
Isn't this the point of having the voting form change from light blue to yellow when the scoop has been promoted?
Anyhow, I test the patch. It works fine, except on the homepage. It cannot determine that it is "Popular" from the $action.
#6
#7
Hi,
Phil, what does $action contain for the home page? It really should be "popular" as well...
I am a bit lost on this one. But in general I agree on the Div as long as it doesn't break the theme.
Merc.
#8
Merc,
Could use some help with using drupal_is_front_page.
#9
Hi,
Not following you :D
Merc