I'm theming a view and want to include various fields in the .tpl.php file, but don't want them displayed normally. So I tick the 'Exclude from display' box, but then they don't appear in the $fields variable for me to use in the .tpl.php file...
I'm assuming I've misunderstood something and that this is by design, so could someone please explain this to me?
Comments
Comment #1
dawehneri can't explain it, but
you can solve it by don't expose it and do custom theming
ps: i removed the exclude fields issue tags, this are definitve not the right way to use them
Comment #2
Cool_Goose commentedHappens on 2.5 as well
Marked it as a bug (someone else move it if i'm wrong).
So create a view > add some fields > exclude the field from display (in the hope of doing advanced theming) > it doesn't show in $fields anymore (used dsm());
Workaround. Leave it without the exclude. Do strip_tags on the content.
/update
It seems that it conflicts a bit with the devel module themer component.
Ex:
You have an image cck field that you add it as a field in the view;
Without the themer you only get the link to the image in the content, with it you get all the spans of the themer module around the url => breaks
<img src="<?php print $fields['my_image_field']->content" />Comment #3
Anonymous (not verified) commentedClosing this issue. As explained, this can be 'fixed' by not excluding fields, and then simply not outputting them in the template file.