diogo Posted September 11, 2013 Share 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 Link to comment Share on other sites More sharing options...
Soma Posted September 11, 2013 Share Posted September 11, 2013 try $input->urlSegmentsStr $input->urlSegmentStr #280 WireInput.php 3 Link to comment Share on other sites More sharing options...
diogo Posted September 11, 2013 Author Share Posted September 11, 2013 try $input->urlsSegmentsStr $input->urlsSegmentStr #280 WireInput.php Hm, doesn't echo anything... Link to comment Share on other sites More sharing options...
Wanze Posted September 11, 2013 Share Posted September 11, 2013 It's urlSegmentsStr or urlSegmentStr (typo) 4 Link to comment Share on other sites More sharing options...
diogo Posted September 11, 2013 Author Share Posted September 11, 2013 much better Link to comment Share on other sites More sharing options...
Soma Posted September 11, 2013 Share Posted September 11, 2013 Ah sorry for the typo! Link to comment Share on other sites More sharing options...
ryan Posted September 14, 2013 Share 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 Link to comment Share on other sites More sharing options...
diogo Posted September 14, 2013 Author Share 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. Link to comment Share on other sites More sharing options...
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