Only the first item in the view showing up
rick_random777 - August 7, 2008 - 16:21
| Project: | Active Template |
| Version: | 5.x-1.0 |
| Component: | User interface |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
I've just discovered this module and it looks really useful. I wish I'd discovered it a few weeks ago - it'd saved me a great deal of work...
Just one thing - when I create a new field or teaser template, only the first node in the view shows up.
When I change it back to the standard list view in the 'View Type' drop-down, the rest of the nodes re-appear.
Is there something I've missed?
The code in my field template box is as follows:
<div class="3column">
<?php print $nodes[0]->node_title['value']['view'] ?>
<?php print $nodes[0]->node_data_field_artist_images_field_artist_images_fid['value']['view'] ?>
</div>
#1
I got similar issue.
#2
Are you looping through them?
This is most likely a problem where the view is always accessing the zero'th element.
Try this.
<div class="3column"><?php
foreach ($nodes as $node) {
print $node->node_title['value']['view'];
print $node->node_data_field_artist_images_field_artist_images_fid['value']['view'];
}
?>
</div>
#3
Alternatively you can use an index too.
For instance...
$index = 0;while($index < 10) {
print $nodes[$index]->title (or whatever);
$index++;
}
The point is, whatever you do, DON'T use a constant number as an index! This is an array of items. Remember... An array...
#4
will be very helpful module, but for right now i have the same problem. simple view with some nodes field template setup and activated. template code:
<?php
foreach ($nodes as $node) {
print $node->node_title['value']['view'];
}
?>
only 1 template on that view, cleared views cache, anything else to try?
EDIT: this comment should have been placed in issue 287342. questioned asked there.