I am new in Drupal. I am currently developing an e-commerce site using drupal 7. I want to know how can i pass an array of nid to views_embed_view('view_name','display_name',contextual filter) contextual filters. Here is my sample code-
foreach($result as $record)
{
$querystring .= "+";
$querystring .= $record->nid;
}
$querystring = ltrim($querystring, '+');
views_embed_view('tours_listings', 'page_2',$querystring);
You can add accomplish this by: Checking the
Then instead of code above:
$recordIds = array();foreach($result as $record){$recordIds[] = $record->nid;}$querystring = implode('+', $recordIds);//Do not forget to print this out.print views_embed_view('tours_listings', 'page_2', $querystring);