Normally (on the web) you pass an argument by writing:
/someUrl?firstparameter=3
or this for two parameters
/someUrl?firstparameter=3&someName=20
Why isn't this how it works in Drupal? (Nevermind)
So, I have created my view with a page display so I can set a path, which I set to /articles.
I added an argument-rule to take a node id (NID), meaning I want to get the Node of that NID returned in my view (node-view-myview.tpl.php)
When I enter the url /articles I come to node-view-myview.tpl.php.
But unless I get the $node it's useless.
I want to do something like this /articles?theNodeIdIWantTheViewToLoadANodeBy=30
(view argument logic)
return Node getNodeById(30);
No in the node-view-myview.tpl.php I should be able to do:
echo $node->title; // or whatever I wish to do with the node.
Someone knows how you pass a parameter?
Comments
Comment #1
Mattias Holmqvist commentedSolved.
Any view logic is uneccesary for this simply task.
Just have a page view with a path set. in this case the path is set to /articles.
(url)
/articles?nid=4
(node-view-viewname.tpl.php)
$node = node_load($_GET["nid"]);
// now do whatever with the $node
Comment #2
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #3
Cosmy commentedThank you.. very usefull.
But if I use the autopath module, how do i do to retrive the node nid?
Comment #4
liezie_d commented-- edited --
(sorry, replied to wrong post, and i can't find the button to remove my reply)