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

Mattias Holmqvist’s picture

Status: Active » Fixed

Solved.

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

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

Cosmy’s picture

Thank you.. very usefull.
But if I use the autopath module, how do i do to retrive the node nid?

liezie_d’s picture

-- edited --
(sorry, replied to wrong post, and i can't find the button to remove my reply)