diogo Posted September 11, 2013 Posted September 11, 2013 Echoing $input->urlSegments returns a useless "Array". Would be nice if it would return "segment1/segment2/segment3/", so we could easily build the current url like this: $page->url.$input->urlSegments. What do you guys think also of having a url property for $input that returns the current url with segments and pagination $input->url? Edit: Anyway, just for reference, this can be done with $_SERVER['REQUEST_URI']. I'm only proposing a PW way 1
Soma Posted September 11, 2013 Posted September 11, 2013 try $input->urlSegmentsStr $input->urlSegmentStr #280 WireInput.php 3
diogo Posted September 11, 2013 Author Posted September 11, 2013 try $input->urlsSegmentsStr $input->urlsSegmentStr #280 WireInput.php Hm, doesn't echo anything...
Wanze Posted September 11, 2013 Posted September 11, 2013 It's urlSegmentsStr or urlSegmentStr (typo) 4
ryan Posted September 14, 2013 Posted September 14, 2013 Echoing $input->urlSegments returns a useless "Array". Would be nice if it would return "segment1/segment2/segment3/", so we could easily build the current url like this: $page->url.$input->urlSegments. Like mentioned above, urlSegmentStr is your ticket. Note that it has no trailing slash, so you may need to add one to it in some instances. Also want to mention that the $input->urlSegments Array is not useless at all – I use it all the time. Just one small example is to count the number of urlSegments: count($input->urlSegments); 2
diogo Posted September 14, 2013 Author Posted September 14, 2013 I don't mean that the array itself is useless, but echoing "Array" is. Like with pageArrays. the object returns an array, but echoing it turns it into a string with the page ids.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now