By peti2006@googlemail.com on
Hi,
I've just updated my site from Drupal 5 to 6.
I got a View called 'gallery' and to override the output of block, I used the following function on D5.
function phptemplate_views_view_gallery($view, $type, $nodes) {
$fields = _views_get_fields();
foreach ($nodes as $node) {
..................................................
}
return $output;
}
But, In drupal 6, I used the following code in template.tpl.php
function mythemename_preprocess_views_view__gallery(&$variables) {
$variables['foo'] = 'Hello World';
}
and created a new template called 'views-view--gallery.tpl.php' in my theme directory.
if ($foo) {
print $foo;
}
It is 'unformatted' style. I've already cleared 'cache' under Admin>>Performance.
But, It doesn't work.... I can still see the default one. I don't see 'Hello World' text on 'gallery' views.
I'm not sure I'm doing right. Can anyone help me please?
Many Thanks in advance.
Comments
:-D
sorry, it was my stupid mistake. Actually, I was looking into wrong template.
It's working now..
individual fields
Another question.
Actually I also have to override individual fields of Views.
eg., in Drupal 5, I can easily know node ID ($i) of each row.
All I want to do is to add css (id="listItem_'.$i.'")
But, in Drupal 6, how can I know nodeID of each row in views-view-list--VIEWNAME.tpl.php ?