I am attempting to get data from a different node. I am assuming that the views PHP enhances the content already in views. In my view I have the field and filter area set to the following:

In the field area I have two variables.

Content: Title
Global: PHP

In my filtering area I have the following:

Content: Published (Yes)
Content: Type (= my page)
(flag) Flags: Flagged (True)

So.... Since I have already establish which node we are talking about inside the view I should now be able to refine my requirements using the "Views PHP" module.....Well.... I thought that would be the case but Views PHP does not make any reference to the data in the view. I am confused to say the least. I could use a detailed documentation on how this module is useful.

What I need to do is first select the node I want to evaluate. I have my view located on the home page but I want to see data from several nodes in the same view.

How do I filter for the following:

Nodes that have been flagged
Nodes of type "My page"
Nodes that are published
Nodes that are in the same book
Nodes in the same book of the type " my other pages"

Normally I would include some code here but the Views PHP module does not appear to use the same nomenclature as if used in a Drupal function.

Can anyone give me a hand with removing this cloud of unknown?




spineless’s picture

Issue summary:View changes


ChrisValentine’s picture

Firstly apply the "published=yes" and type filters in the normal way.

Views PHP does work as a filter so long as you understand that the "Available variables" tokens don't work (there's another issue been raised about this), but you can grab all of the fields from the recovered node (row) programmatically using:

$node = $data->_field_data['nid']['entity'];

If you have used entity references (your book type might use that) and you want to filter on those as well, you'll have to work a little harder to retrieve any values (other than the nid) from those.

Once you find the fields you want to filter on, you can test their contents and return TRUE or FALSE depending on whether you want that "row" displayed or not.

ChrisValentine’s picture

Issue summary:View changes