Drupal - Two column node list
Normally drupal node list is single column only. We can change number of columns for node list display. In this site nodes are displayed in 2 column.
This I did by hacking node.module. This can be done by CSS and at template level. I feel comfortable with coding, I hacked node.module. I am now progressing well in templates and css.
Here is the code for node.module(function node_page_default - line 2010) to achieve multi column node list.
------------------------
/*
//----G commented for two column list
while ($node = db_fetch_object($result)) {
$output .= node_view(node_load($node->nid), 1);
}
*/
//----G TWO COLUMN View
$output = '<table class="twocolumnlist">';
$counter = 0;
while ($node = db_fetch_object($result)) {
if(!($counter % 2)){
$output .= '<tr><td valign="top" width="50%" class="twocolumn1">'.node_view(node_load($node->nid), 1).'</td>';
}else{
$output .= '<td valign="top" width="50%" class="twocolumn2">'.node_view(node_load($node->nid), 1).'</td></tr>';
}
$counter++;
}
$output .= '</tr></table>';
------

|
I cannot get this modification to work. It gives me an error message. My drupal version is 5.1
Could you be more specific as to what code to replace?
Thanks