Skip to main content
improved formatting; removed "I found this person" when the link was for a question, not a user profile
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

I have a simple View that has a global custom text field with the value of "hi". I have a global PHP field that tries to print this value with, echo $row->nothing;.

echo $row->nothing;

As this is the strange name that's listed in the available variables of the PHP field. The result is nothing. If I try to dump the content of $row$row with, echo var_dump($row);.

echo var_dump($row);

The resultoutput is, { ["nothing"]=> NULL } the following.

{ ["nothing"]=> NULL }

When I try the same thing with a Math Expression instead of a Custom Text, it works as expected, printing out the result of the expression. Some fields seem to work, while others don't. Unfortunately the ones I want to use don't work.

I found this personWhy does Views PHP give me NULL for $row->path? discussing a similar problem, but I wasn't able to translate their solution intothe given answer did not help in solving the problem I've described. Any help is much appreciated!

I'm using Drupal 7.77, Views 7.x-3.29, and Views PHP 7.x-1.1.

I have a simple View that has a global custom text field with the value of "hi". I have a global PHP field that tries to print this value with,

echo $row->nothing;

As this is the strange name that's listed in the available variables of the PHP field. The result is nothing. If I try to dump the content of $row with,

echo var_dump($row);

The result is, { ["nothing"]=> NULL }

When I try the same thing with a Math Expression instead of a Custom Text, it works as expected, printing out the result of the expression. Some fields seem to work, while others don't. Unfortunately the ones I want to use don't work.

I found this person discussing a similar problem but I wasn't able to translate their solution into solving the problem I've described. Any help is much appreciated!

I'm using Drupal 7.77, Views 7.x-3.29, Views PHP 7.x-1.1

I have a simple View that has a global custom text field with the value of "hi". I have a global PHP field that tries to print this value with echo $row->nothing;.

As this is the strange name that's listed in the available variables of the PHP field. The result is nothing. If I try to dump the content of $row with echo var_dump($row);.

The output is the following.

{ ["nothing"]=> NULL }

When I try the same thing with a Math Expression instead of a Custom Text, it works as expected, printing out the result of the expression. Some fields seem to work, while others don't. Unfortunately the ones I want to use don't work.

I found Why does Views PHP give me NULL for $row->path? discussing a similar problem, but the given answer did not help in solving the problem I've described.

I'm using Drupal 7.77, Views 7.x-3.29, and Views PHP 7.x-1.1.

edited tags
Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284
Source Link

Views PHP row-> returns NULL

I have a simple View that has a global custom text field with the value of "hi". I have a global PHP field that tries to print this value with,

echo $row->nothing;

As this is the strange name that's listed in the available variables of the PHP field. The result is nothing. If I try to dump the content of $row with,

echo var_dump($row);

The result is, { ["nothing"]=> NULL }

When I try the same thing with a Math Expression instead of a Custom Text, it works as expected, printing out the result of the expression. Some fields seem to work, while others don't. Unfortunately the ones I want to use don't work.

I found this person discussing a similar problem but I wasn't able to translate their solution into solving the problem I've described. Any help is much appreciated!

I'm using Drupal 7.77, Views 7.x-3.29, Views PHP 7.x-1.1