By Anonymous (not verified) on
Hi !
First, Merry christmas and best wishes to you :)
I have a strange problem with the Views Theme Wizard. I've created a new view and the wizard generates this code
TEMPLATE.PHP
/**
* views template to output a view.
* This code was generated by the views theming wizard
* Date: 25 December, 2006 - 18:41
* View: Discs
*
* This function goes in your template.php file
*/
function phptemplate_views_view_list_Discs($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-Discs', $vars);
}
if ($items) {
return theme('item_list', $items);
}
}
MYCUSTOMCONTENT.TPL.PHP
<?php
/**
* views template to output one 'row' of a view.
* This code was generated by the views theming wizard
* Date: 25 December, 2006 - 18:41
* View: Discs
*
* Variables available:
* $view -- the entire view object. Important parts of this object are
* Discs, .
* $view_type -- The type of the view. Probably 'page' or 'block' but could
* also be 'embed' or other string passed in from a custom view creator.
* $node -- the raw data. This is not a real node object, but will contain
* the nid as well as other support fields that might be necessary.
* $count -- the current row in the view (not TOTAL but for this page) starting
* from 0.
* $stripe -- 'odd' or 'even', alternating.
* $field-pochette-du-disque-fid --
* $field-pochette-du-disque-fid_label -- The assigned label for $field-pochette-du-disque-fid
* $field-nom-de-lalbum-0-value --
* $field-nom-de-lalbum-0-value_label -- The assigned label for $field-nom-de-lalbum-0-value
* $field-nom-de-lalbum-value --
* $field-nom-de-lalbum-value_label -- The assigned label for $field-nom-de-lalbum-value
* $link -- This will create a link to the node; fill the option field with the text for the link. If you want titles that link to the node, use Node: Title instead.
* $link_label -- The assigned label for $link
*
* This function goes in your views-list-Discs.tpl.php file
*/
?>
<div class="view-label view-field-field-pochette-du-disque-fid">
<?php print $field-pochette-du-disque-fid_label ?>
</div>
<div class="view-field view-data-field-pochette-du-disque-fid">
<?php print $field-pochette-du-disque-fid?>
</div>
<div class="view-label view-field-field-nom-de-lalbum-0-value">
<?php print $field-nom-de-lalbum-0-value_label ?>
</div>
<div class="view-field view-data-field-nom-de-lalbum-0-value">
<?php print $field-nom-de-lalbum-0-value?>
</div>
<div class="view-label view-field-field-nom-de-lalbum-value">
<?php print $field-nom-de-lalbum-value_label ?>
</div>
<div class="view-field view-data-field-nom-de-lalbum-value">
<?php print $field-nom-de-lalbum-value?>
</div>
<div class="view-label view-field-link">
<?php print $link_label ?>
</div>
<div class="view-field view-data-link">
<?php print $link?>
</div>
and the CSS
but the problem is that when I use this code, a list of "0' is displayed
#
0
0
0
0
0
0
#
0
0
0
0
0
0
and if this code is not enabled the content is displayed normally.
Second question... :)
The content consists in a list of small thumbnails and I'd like to link them to the full node and add for title another text field but I don't know how to handle this...
I hope you can help me.
Thank you :)
Comments
a list of zero
In two words...
The theme wizard's code results in a list of zero (0) Did you experience this problem too ?
My problem was solved by this...
http://drupal.org/node/104459
It's a bug with the theme wizard...