With SEO friendly URLs enabled, MODx gets a request like
www.mydomain.com/path/doc and then "
path/doc" gets resolved so that the MODx page with the alias "doc" within the "path" folder would be displayed. Fine. If I try to navigate to a URL like
www.mydomain.com/path/doc/does_not_exist (where there isn’t a page with that alias), then I end up being redirected to the 404 page.
What if I want the
path/doc page to grab the "
does_not_exist" part of the URL and use it in a custom database query?
I’m trying to simplify my question so it’s clear, but here’s some more info to clarify what I’m trying to do:
I have some custom tables in my database that I’d like MODx to read from. I can use a @SELECT binding or a Snippet to read information from these tables and display it to the user, but right now I’m limited to hard-coding a static query each time I want to display information. I’m hoping I can use the URL segments to
dynamically generate those queries so I can display the information I want, i.e.
path/doc/something would ultimately end up as a SQL query like
SELECT * FROM my_custom_table WHERE id='something';
If there are no search results, then it could roll over to the 404 page as per usual.
A lot of frameworks have something like
path/doc/123 where "123" is the unique database id.... that’s really what I’m hoping for, and again the only reason I want that kind of access is so that I can *easily* get to the data in those custom tables.
Can anyone point me in the right direction?