Skip to content

Instantly share code, notes, and snippets.

@phillipadsmith
Created June 26, 2009 17:03
Show Gist options
  • Save phillipadsmith/136596 to your computer and use it in GitHub Desktop.
Save phillipadsmith/136596 to your computer and use it in GitHub Desktop.
/**
* views template to output a view.
* This code was generated by the views theming wizard
* Date: June 26, 2009 - 12:34pm
* View: enews_dail_top_picks
*
* This function goes in your template.php file
*/
function phptemplate_views_view_list_enews_dail_top_picks($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'];
}
}
$items[] = _phptemplate_callback('views-list-enews_daily_top_picks', $vars);
}
if ($items) {
return theme('item_list', $items);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment