By patchak on
How can I use php to pull out the nid's of the nodes that are referenced by the "current" node??
I would provide a nid as argument and from that argument I would pull out the referenced nodes that are linked FROM that node.
I know I can pull that information using a little php but I don't know how to do it...
Basically it's just about getting he nid's of the nodes referenced from a specific node provided by an arg, could anyone help proving the necessary php for that?
Thanks,
Patchak
Comments
<?phpif (!$link =
Change the database connection information to your own, and change foo and bar to the appropriate tables and variables.
I recommend going to php.org and downloading the windows help file edition of the php manual. It has everything you need under function reference/Mysql and you can learn a little php. It's easy!
Thanks for the answer,
Thanks for the answer, unfortunately I'm not sure I can use this with the views php filter field (http://drupal.org/project/viewsphpfilter) The idea is that I need some php code to get the current node's ID provided by the views arg and then pull out the nodes that are linked from that node using nodereference.
You have a more precise idea on how I can do this using those tools??
thanks, Patchak
Création de sites web
Actualité informatique en live
Actually, a similar approach
Actually, a similar approach will work. You can get the nid's for Views PHP Filter with a database query, like the above. If you're looking for links to a particular node in the node contents, you'd need a LIKE search on the contents with the link. Return the node list you get back from the query in an array and you're done.