Tell me more ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

Drupal 7.22 Views: 7.x-3.7

i have the field "content:path" and i want to output the containing data with php. I use a global php field.

it shows me this:

Available variables

$row->path: Inhalt: Pfad

but the output with print $row->path gives out a number only and not the content path. Then i tried print_r($data) to look for the correct output information. but there i dont found anything about the field: content:path

any solution to get the data of this field to php?

regards

share|improve this question

1 Answer

up vote 2 down vote accepted

Indeed, views PhP doesn't always get the processed field and only gives you the nid instead. You have to use $data as you tried (by the way, easier is to dpm($data) than print_r).

if it doesn't give you any info on what you're looking for, you can simply obtain your content:path by using drupal_lookup_path :

$path = drupal_lookup_path('alias', 'node/' . $data->nid);
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.