1

Page callbacks can receive wildcard arguments through the Drupal (6 and 7) menu system and using this results in quite nice and clean URLs. Core uses this for things like loading the nodes by their node id. The alternative is to use straight query parameters from $_GET as usual in PHP. Core seems to use this in a few places, for form redirects, the pager etc.

When would it be appropriate to bypass the menu system and just use a query parameter? What are the pros and cons of the two options for parameter handling?

1

There's a page with a logic that puts it together and that is determined by path. Core never bypasses the menu router. Parameters are somewhat orthogonal to this. For example, a page doesn't change in itself just because there's a form in it that uses a destination to redirect to said page so we do not add it to the clean URL. Pager is a little different because you could argue that path/to/some/view could become path/to/some/view/1 path/to/some/view/2 as it is paged but how do you differentiate real arguments (like a node id) from a pager? It's better to use a query parameter.

2
  • Ok that mostly answers my question. What's the difference between a real argument and a pager page though? I suppose a node id refers to an actual piece of data while a pager page is just a different view to a part of a page at a given path.
    – casrock
    Aug 15 '12 at 9:38
  • I guess Views pager could be imolemented as a contextual filter, yes -- but it would cause some difficulties when trying to page a search result: you search for foo/bar...
    – user49
    Aug 15 '12 at 19:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.