I am working with Drupal 6.6 and the new views 2 module. I am trying to output a view after executing some PHP code. My site has a form that enables visitors to search nodes - a company and a program node. One company can have many programs so I have used the node reference function to create a mini relational database. An example of a search might be to choose all programs that are in Argentina, are under $1000 and last 5 weeks. The php part that builds the sql works fine and the results of the query are Node IDs.
So it should be simple to just feed the Node IDs into a view and then get the view to spit out the data. I guess I am not understanding how to feed the list of Node IDs into the views argument. This is what I am using:
$output = views_embed_view("search", "page", $myview_args) ;
My view has an argument set as Node: Nid
So I basically have a list of Nod ids I'm going to put in $myview_args. How do I place them in this variable. I have tried:
$myview_args = "23, 44, 100" and
$myview_args = "23 44 100" and
$myview_args = array("22 44 100)
$myview_args array("Nid => 363");
I don't seem to be able to pass the argument into the function ? I can go to my view, enter Node ids as arguments and do the live preview thing and it works fine. Your suggestions?