• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 2.0 I got a complicated route parameter issue...

Jaxel

Well-known member
#1
So I used a bit more complicated routes in XF1... for instance:
To do this, I used a helper to create the key, which is essentially $id.$val1.$val2. Then when I read it into the controller, I would just read the string parameter and explode it based on . to get back the 3 parameters I needed.

So I'm trying to construct a similar URL in the new XF2 system.

What I did was create a getter in my entity for stream_key that returns "1.8wayrun.5521605" as requested.

I then put that into the route as follows: :str<stream_key>/:page

However, doing so returns errors:
Code:
The requested page could not be found. (Code: invalid_action, controller: EWR\Rio:Stream, action: 18wayrun5521605)
Anyone got any ideas?
 

Jaxel

Well-known member
#2
I appear to only have this issue when the route is :str<>, if I use :int<>, the route continues without issue (although, I don't have all the information I need.

It also appears to be an issue with periods in the URL.
 

Jaxel

Well-known member
#3
So I'm trying to find a non-standard character to use in the URL instead of period... but it looks like the only characters that don't produce this error are A-Z a-z 0-9 - and _. Unfortunately, I can't use any of these characters as separators, because they can be in the string themselves.
 

Jaxel

Well-known member
#4
I think I got it!
Code:
:int<service_id>/:str<stream_value1>/:str<stream_value2>/:page
This did the trick for me. I guess since XF2 doesn't let you build your own routeMatch anymore... they at least allow you to build more complex URLs.