Jump to content

Recommended Posts

Posted

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 ;)

  • Like 1
Posted

try

$input->urlsSegmentsStr
$input->urlsSegmentStr

#280 WireInput.php

Hm, doesn't echo anything...

Posted
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); 

  • Like 2
Posted

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...