Using views PHP I created an output as follows:

<?php 
  if ($value) {
    print $row->name;
    print $row->view;
  } 
?>

where $value is always true for now (while debugging). The output I get is just from $row->name but not $row->view. Any idea on what I need to do?

Below are the available tokens as they are listed:

    $view: The view object.
    $handler: The handler object.
    $static: A variable that can be used to store reusable data per row.
    $row: Contains the retrieved record from the database (e.g. $data->nid).
    $row->tid: Taxonomy term: Term ID
    $row->name: Taxonomy term: Name
    $row->view: Global: View
    $row->php: Global: PHP
    $data: Contains the retrieved record from the database (e.g. $data->nid).
    $value: Value of this field.
CommentFileSizeAuthor
#3 view-exported.txt17.64 KBreg
#3 view-inserted-exported.txt49.69 KBreg

Comments

reg’s picture

Title: Using tokens » Using views tokens

I should mention that the purpose of this is to only display $row->name when $row->view is not empty. Otherwise I can get a bunch of titles with no data under them.

damiankloip’s picture

Can you export your view? I will then take a look :)

reg’s picture

StatusFileSize
new49.69 KB
new17.64 KB

Attached first the view with the issue and 2nd the view being used as a field. The display is "pages-tmp".

reg’s picture

Did you manage to find anything on this issue?

damiankloip’s picture

Hmm, not sure vfv will work for stuff like this. Is this view (second one) returning results ok normally? views_php will be working when the field is being rendered no? So the vfv field hasn't been processed yet.....?

reg’s picture

Is this view (second one) returning results ok normally?

It renders just fine when there is something to render, if you mean does it return some sort of code in a programming sense then how do I check that? (I am a programmer so I can do some checking but I don't have experience with programming views)

views_php will be working when the field is being rendered no? So the vfv field hasn't been processed yet.....?

It works when I'm not using it's token but instead use it in the normal way.

alibama’s picture

well this is exactly what i'm trying to do = apparently this field doesn't get processed until after the rest of the view is processed... am wondering whether there is some sort of workaround for this

damiankloip’s picture

Do you have query aggregation turned on? This may give you some joy, but maybe not. I haven't tried it. Alot of vfv processing is done in the render method on the field handler, so you wouldn't have this info available before hand.

damiankloip’s picture

Status: Active » Closed (works as designed)

I think this is a 'works as designed' as the view is built in the render stage, you won't have too much joy trying to use views php with it.