2
votes

I have CCK and Views module installed. For the sake of this question scope, I'll call the content type as Project. Projects have many Members.

Project nodes are accessible through /project/project-name. I want to be able to display list of members through path /project/project-name/members.

Is there any way to do this?

Currently I have a views setup for page display on path /project/%/members, and have the argument taken from the url. I realize I can't use "Node ID from URL" option directly since it's node name instead of node id. Therefore I tried to enable "PHP Code" argument. But the problem is, Drupal Views always assume that the parameter is "project-name" and therefore ignored my php code argument setting. Anyone knows how I might be able to do this?

Thanks

4

4 Answers

2
votes

Yes, you can actually use the "Node ID from URL" option, and you should.

Use the path or pathauto module to generate human-readable URLs for your projects in the form project/project-name. This will create a human-readable alias for the node, but the underlying Drupal system path is still node/nid.

Views can still use the "Node ID from URL" as an argument (or Contextual filter, as they are known in Drupal 7) even with human-readable aliases for those ugly paths.

1
votes

If the project's name is the node title you can get what you want pretty easily.

You can pass the node title as argument instead of the nid, but the result will be the same. You get some options to use lowercase, transform - to space ect, as what you can do in a url is limited compared to a node title.

The rest of the view would be the same, as the solution using node nids in the url.

0
votes

You need to create path aliases for /project/project-NID/members to /project/project-Name/members

0
votes

I asked this exact question a month ago. :)

drupal link to view dependent on argument