Is there a way to get a certain fragment of a path, similar to what we had in v2?
Don’t know if there is a shortcut, but this works:
<?php dump($kirby->request()->url()->path()->nth(2)) ?>
Ah, I see. Thank you!
But this is only referring to the whole URL not to the relative path, right? Something like
$kirby->path()->nth(2) doesn’t work. (Which would come in pretty handy.)
Yes, it uses the complete URL, so you get any subfolders in the URL as well. And yes, unfortunately not, because
$kirby->path() just returns a string.
I haven’t found any better way yet.
$pathPart = (new Kirby\Http\Path($kirby->path()))->nth(1); dump($path);
If there is nothing better, we could wrap that into a function.
Yes, would be good to have that feature back. Thanks again!