url alias and argument passing

ovgray - January 3, 2007 - 04:58

I'm new to drupal. I have I have 5.0-rc1 installed as 'http://drupalsite.tld' (not its real name). The Path module is active. Clean urls are enabled.

I have created a page 'node/9' with 'members' as its alias. I can see the page both at 'http://mysite.tld/node/9' and at 'http://mysite.tld/members'.

I want to pass a parameter to this page in its url.

If I point my browser at 'http://mysite.tld/node/9/138' the 'node/9' aka 'members' page is displayed (I have not yet modified the page to use the parameter).

If I point my browser at 'http://mysite.tld/members/138', however, I get 'Page not found'.

From what I've read I thought the way drupal works is that if I try to access 'http://drupalsite.tld/a/b/c' and there is no page named 'a/b/c', drupal will look for a page named 'a/b'. It's doing that with 'node/9/138' (goes to 'node/9') but not with 'members/138' (doesn't go to 'members').

What am I missing?

path ... members/138',

rup3rt - January 3, 2007 - 10:02

> path ... members/138', however, I get 'Page not found'.

You have to manually give a url path for every node.

This can be automated by modules like: Category (4.7), EasyFilter (5.x)

  • You can also integrate with breadcrumbs (Custom Breadcrumbs) and menus (Advanced menu item settings 4.7) or everything together (Category module)
  • Localizer module will do language based url paths
  • They are working on the update to category module for Drupal 5 at http://drupal.org/node/85239

    r3

  • So I need to write a module?

    ovgray - January 3, 2007 - 20:56

    So to get this to work it appears I would have to write a module that responds to the path 'members' and write a menu hook that handles the added parameter ('138' or whatever)?

    Without a hook, members/138

    rup3rt - January 4, 2007 - 11:35

    Without a hook, members/138 returns not found. With a hook, they go to the default for the traceable root. node/9/eat/my/shorts goes to node/9.

    You could write a module if you want. Here is a Drupal 5 example of a similar menu hook:
    http://cvs.drupal.org/viewcvs/drupal/contributions/modules/biblio/biblio...
    There are repeatable examples in modules of the "review" type too.

    CCK, category module and other mods provide a similar learning curve and maybe greater functionality over the same time period. Of course they also provide quicker rollout, easier taxonomy integration and tuned performance.

    Thanks

    ovgray - January 7, 2007 - 00:55

    I have a lot to learn. Thanks for the advice.

     
     

    Drupal is a registered trademark of Dries Buytaert.