I’m using the Views PHP module with the following code:
<?php
echo $row->title;
echo $row->field_home_away_or_neutral;
echo $row->field_team;
echo $row->field_opponent;
echo $row->field_goals_scored;
echo $row->field_goals_conceded;
?>
This prints the title correctly but all other variables are returned the same number per row e.g. 17 17 17 17 17 then 15 15 15 15 15
These fields are taxonomy terms and integers.
How do I print the actual values e.g. $row->field_home_away_or_neutral would be either ‘Home’, ‘ Away’ or ‘Neutral’?
Available variables:
$view: The view object.
$handler: The handler object.
$static: A variable that can be used to store reusable data per row.
$row: Contains the retrieved record from the database (e.g. $data->nid).
$row->title: Content: Title
$row->field_home_away_or_neutral: Field: Home, Away or Neutral
$row->field_team: Field: Team
$row->field_opponent: Field: Opponent
$row->field_goals_scored: Field: Goals scored
$row->field_goals_conceded: Field: Goals conceded
$row->path: Content: Path
$row->php: Global: PHP
$data: Contains the retrieved record from the database (e.g. $data->nid).
$value: Value of this field.
Thanks,
S
Turns out this is a bug in Views PHP (see http://drupal.org/node/1140896)
You can get to the values using:
… where _field_home… is the field you want to target.
Use the Devel module and
to build the correct ‘path’ to the value.