no content in list view; table view works fine
amanda - May 14, 2007 - 15:44
| Project: | Views |
| Version: | 5.x-1.6-beta5 |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
I'm trying to create a fairly simple block that lists titles for nodes with a a particular taxonomy term. For some reason I don't get any content when I use the "List" view, though the view works fine when I use "Table". Here is the export output of both versions:
The list view doesn't display any content, but it does display a series of tags that look meant to hold content:
<?php
$view = new stdClass();
$view->name = 'viz_arts_list';
$view->description = 'Recent content from the Visual Arts Collective';
$view->access = array (
);
$view->view_args_php = '';
$view->block = TRUE;
$view->block_title = 'Current Exhibitions as List';
$view->block_header = '';
$view->block_header_format = '1';
$view->block_footer = '';
$view->block_footer_format = '1';
$view->block_empty = '(Sorry, there isn\'t any content for this block right now.)';
$view->block_empty_format = '1';
$view->block_type = 'list';
$view->nodes_per_block = '5';
$view->block_more = FALSE;
$view->block_use_page_header = FALSE;
$view->block_use_page_footer = FALSE;
$view->block_use_page_empty = FALSE;
$view->sort = array (
);
$view->argument = array (
);
$view->field = array (
array (
'tablename' => 'node',
'field' => 'type',
'label' => '',
),
array (
'tablename' => 'node',
'field' => 'title',
'label' => '',
'handler' => 'views_handler_field_nodelink',
'options' => 'link',
),
);
$view->filter = array (
array (
'tablename' => 'node',
'field' => 'status',
'operator' => '=',
'options' => '',
'value' => '1',
),
array (
'tablename' => 'term_node_1',
'field' => 'tid',
'operator' => 'OR',
'options' => '',
'value' => array (
0 => '1',
),
),
);
$view->exposed_filter = array (
);
$view->requires = array(node, term_node_1);
$views[$view->name] = $view;
?>The table view works fine, but produces a table ...
<?php
$view = new stdClass();
$view->name = 'viz_arts_alt';
$view->description = 'Recent content from the Visual Arts Collective';
$view->access = array (
);
$view->view_args_php = '';
$view->block = TRUE;
$view->block_title = 'Current Exhibitions';
$view->block_header = '';
$view->block_header_format = '1';
$view->block_footer = '';
$view->block_footer_format = '1';
$view->block_empty = '(Sorry, there isn\'t any content for this block right now.)';
$view->block_empty_format = '1';
$view->block_type = 'table';
$view->nodes_per_block = '5';
$view->block_more = FALSE;
$view->block_use_page_header = FALSE;
$view->block_use_page_footer = FALSE;
$view->block_use_page_empty = FALSE;
$view->sort = array (
);
$view->argument = array (
);
$view->field = array (
array (
'tablename' => 'node',
'field' => 'type',
'label' => '',
),
array (
'tablename' => 'node',
'field' => 'title',
'label' => '',
'handler' => 'views_handler_field_nodelink',
'options' => 'link',
),
);
$view->filter = array (
array (
'tablename' => 'node',
'field' => 'status',
'operator' => '=',
'options' => '',
'value' => '1',
),
array (
'tablename' => 'term_node_1',
'field' => 'tid',
'operator' => 'OR',
'options' => '',
'value' => array (
0 => '1',
),
),
);
$view->exposed_filter = array (
);
$view->requires = array(node, term_node_1);
$views[$view->name] = $view;
?>
#1
Here is the output in html of each block:
The Table ...
<div id="block-views-viz_arts_alt" class="clear-block block block-views">
<h2>Current Exhibitions</h2>
<div class="content"><div class='view view-viz-arts-alt'><div class='view-content view-content-viz-arts-alt'><table>
<thead><tr><th class="view-cell-header view-field-node-type"></th><th class="view-cell-header view-field-node-title"></th> </tr></thead>
<tbody>
<tr class="odd"><td class="view-field view-field-node-type">Exhibition</td><td class="view-field view-field-node-title"><a href="/node/1">Founding Fathers</a></td> </tr>
<tr class="even"><td class="view-field view-field-node-type">Featured Artist</td><td class="view-field view-field-node-title"><a href="/node/3">Wayne</a></td> </tr>
<tr class="odd"><td class="view-field view-field-node-type">News Item</td><td class="view-field view-field-node-title"><a href="/node/4">Submission Guidelines</a></td> </tr>
<tr class="even"><td class="view-field view-field-node-type">News Item</td><td class="view-field view-field-node-title"><a href="/node/5">Mobilized - NYC workshop/unconference </a></td> </tr>
<tr class="odd"><td class="view-field view-field-node-type">Event (Custom)</td><td class="view-field view-field-node-title"><a href="/node/6">FOUNDING FATHERS: An Evening of Performance</a></td> </tr>
</tbody></table>
</div></div>
</div>
</div>
Vs. the output for the list view:
<div id="block-views-viz_arts_list" class="clear-block block block-views">
<h2>Current Exhibitions as List</h2>
<div class="content"><div class='view view-viz-arts-list'><div class='view-content view-content-viz-arts-list'><div class="item-list"><ul><li><div class='view-item view-item-viz-arts-list'></div>
</li><li><div class='view-item view-item-viz-arts-list'></div>
</li><li><div class='view-item view-item-viz-arts-list'></div>
</li><li><div class='view-item view-item-viz-arts-list'></div>
</li><li><div class='view-item view-item-viz-arts-list'></div>
</li></ul></div></div></div>
</div>
</div>
#2
upgrading to 5.x-1.6-beta5 seems to have resolved this.
#3
#4