XF 2.0 Passing two strings in route

Snog

Well-known member
I know you can pass a string with an integer value using :int<id,title>/ but I can't seem to find a way to pass two strings like :str<id,title>/.

Is this even possible?

The reason I'm looking at this is YouTube IDs are strings and well, so are the video titles. It's not something that urgent, but would be nice. ;)
 
This isn't really something we expose -- the str approach doesn't use a dot as a delimiter or anything like that, so it is unlikely to change in the future as well.
 
You can have multiple strings passed into a route, though, we do this in a couple of places.

Check out the content-types route:
Code:
:str<content_type>/:str<field_name>/
They would of course be separated by a slash though.
 
Like I said, it's not something that's urgent or needed, but I thought I would ask.

You can have multiple strings passed into a route, though, we do this in a couple of places.

Check out the content-types route:
Code:
:str<content_type>/:str<field_name>/
They would of course be separated by a slash though.
I tried that an it just blended it all into a single route and threw a page could not be found error.
 
Well, you can see it on your own development board, it would produce a link like this: admin.php?content-types/admin_navigation/admin_search_class/edit.

Is that not what you're after?
 
Well, you can see it on your own development board, it would produce a link like this: admin.php?content-types/admin_navigation/admin_search_class/edit.

Is that not what you're after?
No, I was hoping for a dotted variable like :int would supply. Something like:
Code:
.../music/AdPpQRzcSk8.Teenage+Rampage/musicvideo
I was able to solve it using the added array like normal:
Code:
link('music/musicvideo', $track, {'title' : $track.title})
That gives me a url of:
Code:
.../music/AdPpQRzcSk8/musicvideo?title=Teenage+Rampage
 
What it's used for is to supply the song title to an overlay that opens with the video when the link is clicked:

overlay.webp

It wasn't really important and I could have lived with the default thread title, but I think it looks better this way.
 
Top Bottom