views:

255

answers:

1

I have a views page which tracks posts created by users. Its having a field(comment_count) to show no of comments in a node. the field is working fine except its showing blank spaces in fields with no comments.

I am using the template file views-view-field--tracker--page--comment-count.tpl.php and copying the line <?php print $output;?> as suggested by views. but i have no idea how to modify the template output to ... replace the empty spaces with text such as 'no comments' or something similar. I would really appreciate if anyone can help me on this.

A: 

There are more templates involved in View processing. Go to admin/build/views/, edit your view and see Theme: Information. There you'll get currently used templates, their brief descriptions and default code.

As for field template, there are some 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.
Sam Dark
thanks for answering, i do know about the variables but as i am no programmer i cant make much use of it. And as for templates used right now.. it is "views-view-field--tracker--page--comment-count.tpl.php" and the default code is <?php print $output;?> but it does says... * When fetching output from the $row, this construct should be used: * $data = $row->{$field->field_alias}
Please elaborate "replace the empty spaces with text such as 'no comments' or something similar". Where are these "empty spaces"?
Sam Dark