Drupal 6: Theming a field in views
Basically I want to create a php co开发者_Go百科de in my template (views-view-field--body.tpl.php) that would say the following...
if [body] print [node_view] endif
Off the top of my head and at first look it seems like you are using fields. If it is so, if you look at views-view-field.tpl.php, the comments specify:
Variables available:
- $view: The view object
- $field: The field handler object that can process the input
- $row: The raw SQL result that can be used
- $output: The processed output that will normally be used.
When fetching output from the $row, this construct should be used: $data = $row->{$field->field_alias}
thus you could do something like
if ($row->{$field->body}) {
print $row->{$field->view_node}
}
What I did to do this was download Views Custom Field and then use this code for the value:
<?php
if ($data->node_revisions_body) {
echo '<a href="/node/' . $data->nid .'">view</a>';
}
?>
精彩评论