3

I am using Views PHP and having problem in doing a very basic thing.

In my view I added a field which I have to "Exclude from display" and show it only when there is a specific content type being called on Page.

So I used Views PHP, which checks the content type. The only problem is that I don't know how to output this field.

I used

$row -> myfield_name;

but that doesn't work.

So basically, I just need to use "Available Variables". But the $row->myfield_name doesn't work.

I can't use the following as this gives raw field. I only want to use how this is intercepted in my view and how my view shows it. This is because this field is a video and my view is formatting it with JWplayer and hence calling it will call it as JWPlayer.

$value-> _field_data["body"] ["entity"] -> myfield_name ["und"][0]["value"];

Thanks

3

The variables (or field) that you need to use as Available Variables must be before the Views PHP variable. Besides that install Devel module and use kpr($row) or kpr($view) or kpr($data) to get the available properties of these variables.
Also in "Output" section you can use var_dump or print_r to print available variables.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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