I've installed imagecache module and it works. But i want to use it at views, if i generate a view there is no field connected with imagecache module.

My current php code for that view at template.php

function phptemplate_views_view_list_og($view, $nodes, $type) {
$fields = _views_get_fields();

$taken = array();

// Set up the fields in nicely named chunks.
foreach ($view->field as $id => $field) {
$field_name = $field['field'];
if (isset($taken[$field_name])) {
$field_name = $field['queryname'];
}
$taken[$field_name] = true;
$field_names[$id] = $field_name;
}

// Set up some variables that won't change.
$base_vars = array(
'view' => $view,
'view_type' => $type,
);

foreach ($nodes as $i => $node) {
$vars = $base_vars;
$vars['node'] = $node;
$vars['count'] = $i;
$vars['stripe'] = $i % 2 ? 'even' : 'odd';
foreach ($view->field as $id => $field) {
$name = $field_names[$id];

$vars[$name] = views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $node, $view);

if (isset($field['label'])) {
$vars[$name . '_label'] = $field['label'];
}
}
$output .= _phptemplate_callback('views-list-og', $vars);
}

return $output;

}

But how to use imagecache?

Comments

freakx0’s picture

I've added the picture via "Image Attach" Module. I disabled that and insert via cck a image-field. now it works :-)

Anonymous’s picture

I definitely think that this is the right way to go. The imagefield and imagecache modules work very well together, as well as with views.

-Mike Goodwin
http://www.not2us.net
http://www.redleafmedia.com