Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By Anonymous (not verified) on
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'?
Thanks,
S
Comments
Turns out this is a bug in
Turns out this is a bug in Views PHP (see http://drupal.org/node/1140896)
You can get to the values using:
$data->field_field_home_away_or_neutral[0]['rendered']['#markup'];
... where _field_home... is the field you want to target.
Use the Devel module and
dsm($data);
to build the correct 'path' to the value.
S