Closed (fixed)
Project:
Views (for Drupal 7)
Version:
6.x-2.3
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
2 Apr 2009 at 18:07 UTC
Updated:
8 Jul 2010 at 23:31 UTC
Hi,
After searching the forum, and documentation, I learned that:
print $fields['some_id']->content;
would print out the field value. My field is "field_rating"
I've tried print $fields['field_rating']->content; & print $fields['field_rating_value']->content; to no avail.
I'm using the views-view-unformatted theme. Any help would be greatly appreciated!
:)
Comments
Comment #1
dawehneryou can print out the whole $fields array by using
There you can see all availible variables
Comment #2
Phil Wolstenholme commentedFor me that just brings up an empty drupal message box with a empty set of
tags inside it.
print $fields['postal_code']->content;doesn't work, neither does:I'm trying to echo one single field (the postal_code field) in the header of my gmap view. How could I do this?
I've tried numerous array approaches but haven't yet found the right code. Apologies, because I know this is basically a basic php question, but any help would be hugely appreciated. I have read the Theme:Information documentation, and also Merlin's comments on this thread http://drupal.org/node/286700 - but I still haven't really grasped how to do this.
Comment #3
Phil Wolstenholme commentedSorry to shamlessly bump this when the Views queue is busy, but I'm hoping the solution is just something quick that I just don't know about yet.
Comment #4
dawehnercould you var_export your $fields, then i could help you quite fast :)
Comment #5
Phil Wolstenholme commentedThanks a lot dereine.
Hmm I feel even more stupid, using the code
Var_export: <pre><?php var_export($fields); ?> </pre>gives a NULL result... I'm using it in the header of a page view, with the php filter selected.Comment #6
dawehnercould you also try out $row.
I think $fields is not defined there, see documentation in your views tpl file.
Comment #7
Phil Wolstenholme commentedUnfortunately the same thing happens with $row... There must be a way to get Views data in the header.
Just to give the issue some context, and maybe to help anyone come up with an alternative solution, I'm displaying a map page made up of a Map View for each venue. Above the map I want to have a link to Google Maps's directions finder, with the destination postcode already filled in. To do this I need to insert a link above the Map View display, and include a view field's data within the link....
Comment #8
Phil Wolstenholme commentedHi, I've made the title of this issue a little bit more descriptive and general in the hope that someone will be able to help me.
I've got a Google Maps view set up, but I need to print a link (to driving directions) above or below the GMap element of the view. The content printed (presumably in a header or footer) needs to be a postal code, which is one of the fields in the view.
Does anyone know how I would do this?
Comment #9
esmerel commentedThis issue is a year old, it's likely either resolved or no longer relevant.