Hey,

I've got a view page set up that takes the nid from the URL as an argument to filter all the nodes on the page. The nid comes from a node reference field of the nodes being displayed.

It works when I use it like that eg. (projects/contributors/42).

How can I get it to work by using the Node Title instead of the nid? (projects/contributors/ankabout)

Any ideas would be great thanks.

Comments

Adam S’s picture

Oh, are you using the %? How about trying Views -> Arguments -> NID -> Action to take if argument is not present: -> Provide default argument -> Node ID from URL . It pulls the NID even if you have nice URLs enabled. You can also choose title as the argument.

boby_ui’s picture

I am using node reference in the view > arguments, but there is no option for getting the title, just a node id from url in the provide arguments section, is there a work around to receive the node title as and argument?

luckysmack’s picture

I am trying to get the same exact setup, did you figure out how to accomplish this? When using the title i dont want it to redirect to the NID, but to stay as the title and show all nodes that reference that nodes title.

andrew_hoffi’s picture

Just wondering if anyone has had any luck with this?

Thanks
Andrew
-------------------
www.hoffi.com

boby_ui’s picture

still wondering if anyone comes up with solution

tammo’s picture

Looking for the same possibility, must be something in PHP snippets, but since I am not a programmer, I would not know how to do that...

Tools for Research
http://www.toolsforresearch.com (international)
http://www.kleinestappen.nl (NL)

All using open source software: Drupal, Limesurvey

Syd Barrett’s picture

Probably i haven't understood properly but why don't you try to pass the argument on tpl.php?
print views_embed_view("your_view", "your_display", $node->title);

boby_ui’s picture

how to use the views argument to receive the title and get the content we need?

Syd Barrett’s picture

Argument = Node:Title
Display all values;

on node-yourcontent.tpl.php write

print views_embed_view("your_view", "your_display", $node->title);

boby_ui’s picture

let me try that and get back on you, thank you very much :)

anybody’s picture

I created a tiny module to solve this in modern Drupal: https://www.drupal.org/project/views_argument_default_node_title_from_url

http://www.DROWL.de || Professionelle Drupal Lösungen aus Ostwestfalen-Lippe (OWL)
http://www.webks.de || webks: websolutions kept simple - Webbasierte Lösungen die einfach überzeugen!
http://www.drupal-theming.com || Individuelle Responsive Themes