I have a file views-view--MyView--block-2.tpl.php
there is no $fields
variable, it doesn't exist.
if I do a foreach($view->field as $v=>$f)
and print both $v
will show me all my fields in that view and display
- created
- title
- field_op_author_nid
- field_main_image_fid
- field_teaser_value
- comment_count
but $f is always empty.
How do I access my fields?
[EDIT]
Ok, let me clarify. the .tpl file I have renders just fine. the markup I have in that file shows up. The issue is that I cannot access the fields I set up in the view and displaye. I tried changing the filename to include -fields- and I indeed did get the $fields variable. This looks to be exactly the same as the $view
variable that I had before, which I don't know how to get data out of. I can see the fields I need in there but the var_dump($fields( or $ view))
is about 20 pages long and every example I have seen has been just using $fields["fieldname"]
, which does not work.
Am I just maybe doing this wrong entirely? What is the best way to set these up, is it to have multiple tpl files, one for each field and row?