Drupal 7 Rules: after generating new content, unable to access a view related to this new data -
using rules modules, set rule "after saving new content of type x". so, adding new content of "x" should:
- based on nid, call view, returns json, fetch info work later. info need on view, not in node inserting, view need nid , other info node creating
the problem if nid of new node, when call view returns empty result. seems data it's still not on drupal database, view results empty. tried add sleep(10) before calling view, giving time drupal, no success.
the content published, , added 'save entity' action rule
hope code here helps understand:
dsm($node); //i can see al attributes node inserting $url="http://localhost/bopa/?q=export_cultivos/$node->nid"; dpm($url); //it gives me correct url, tested later directly on browser, works $data=file_get_contents($url); $data2 = json_decode($data,true); dsm($data2); //empty array
i guess passing nid string not variable in url. $node->nid not getting substituted. use following code snippet
$url="http://localhost/bopa/?q=export_cultivos/".$node->nid;
Comments
Post a Comment