-
|
What's the best approach for handling a search URL route that has changing parameters? I have this URL:
All parameters after "http://127.0.0.1:60000/listings/9b1c6/" are optional and changing. The URL is pointing to a search function for which the parameters are used. So how to setup a route for this? |
Beta Was this translation helpful? Give feedback.
Answered by
dbelanger
Aug 7, 2023
Replies: 2 comments 2 replies
-
|
Which version of CFWheels are you using? If it's 2.4 then have you tried
creating a really long route for the URL? I've made some long ones before
but never anything that long so I can't say if it will work or not. If that
doesn't work you could also try some kind of webserver URL rewrite rule to
catch the URL and deal with it that way.
…On Sat, 5 Aug 2023 at 18:46, MvdO79 ***@***.***> wrote:
What's the best approach for handling a search URL route that has changing
parameters?
I have this URL:
http://127.0.0.1:60000/listings/9b1c6/marco/real+estate/apartments/flats/nederland/zh/alphen+aan+den+rijn/vve+balkon
All parameters after "http://127.0.0.1:60000/listings/9b1c6/" are
optional and changing.
The URL is pointing to a search function for which the parameters are used.
So how to setup a route for this?
—
Reply to this email directly, view it on GitHub
<#1275>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHN4QQC72VIYU4FPMHGNQLXT2BHLANCNFSM6AAAAAA3FLALEI>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
2 replies
-
|
Thanks David, I learned something new today as well :-)
…On Mon, 7 Aug 2023 at 13:57, David Paul Belanger ***@***.***> wrote:
I believe you are looking for the wildcard segments
<https://guides.cfwheels.org/cfwheels-guides/handling-requests-with-controllers/routing#wildcard-segments>.
It would look something like this:
.get(name="listings", pattern="listings/[key]/*[searchOptions]",
to="listings##list")
Now, this wildcard segment *[searchOptions] will return
*PARAMS.searchOptions* to your controller and you'll have to treat it
like a "/" delimited list or, even better than a list, use the listToArray(
PARAMS.searchOptioins , '/' ) to convert that list to an array to use for
your search.
—
Reply to this email directly, view it on GitHub
<#1275 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHN4QSRDF2RGURCJKLMXTTXUDQ2NANCNFSM6AAAAAA3FLALEI>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I believe you are looking for the wildcard segments. It would look something like this:
.get(name="listings", pattern="listings/[key]/*[searchOptions]", to="listings##list")Now, this wildcard segment
*[searchOptions]will return PARAMS.searchOptions to your controller and you'll have to treat it like a "/" delimited list or, even better than a list, use thelistToArray( PARAMS.searchOptioins , '/' )to convert that list to an array to use for your search.