Hi,
I have a nodes view, from which I try to exclude nodes given by another view.

So I added a node argument in my view, and gave it a default argument "php code", which is this ('dernierstar' is the second view, the one that gives nodes IDs to exclude) :

$view_name = [dernierstar];
$view_display = [0];
$view_arguments = array();

$this_view = views_get_view($view_name);
$this_view->set_item($view_display, 'filter', 'nid_php', NULL);
$this_view->set_display($view_display);
$this_view->set_arguments($view_arguments);
$this_view->pre_execute();
$this_view->execute();

$results = $this_view->result;
$this_view->destroy();

print $results;

Where am I wrong ?

Thanks !

Comments

dave reid’s picture

Project: Drupal core » Views (for Drupal 7)
Version: 6.14 » 6.x-2.8
Component: node system » node data
esmerel’s picture

Status: Active » Closed (fixed)

No activity in 6 months