Recently Browsing 0 members
No registered users viewing this page.
With JS fetch() it is a bit tricky to get for example $_POST populated (params need to be FormData / forms), but would it possible to get PW $input (get, post, urlSegments, queryString) working for fetch requests?
Is there a fix / hook / workaround to solve it PW side?
I have segments turned on for the root/home page. This is because I'm doing some custom routing to remove a path from the URL.
One of the grandchild pages itself has segments turned on.
So when I'm doing my custom routing from the home page, I look to see if the URL is valid by using a standard get lookup on the segment string. Something like `$pages->get("/myroute/".$input->urlSegmentStr()."/");`
The problem is, the segment string may have a path that itself includes segments, like "/route/allows-segments/segment".
So get() returns nothing, essentially going to 404, because it can't find that path which has a segment in it.
Is there a way to make get() smart enough to see that even though /segment/ isn't found as a page, its parent /allows-segments/ has segments turned on and thus it can get that page instead?
I already programmed my workaround, it's not that big of a deal. I had to specifically test for the segmented URL though. Luckily I only have one page like this, but I can see it being an issue if I had a lot of them.
Perhaps get() needs some kind of options (or another finder function entirely) that can deal with paths with segments. Where it will process the path and check for segments, returning the proper page.
I have a parent page containing a list of it's children. When you click on one of the children the page opens up in a modal box trough ajax. So far so good.
But if i directly load the page through the url (parent/child) i get the child page. Is there a way of loading the parent page instead with the child page opened inside the modal box? I was first thinking of using URLSegments so it would load the parent page with the child name as segment however since the segment is an actual page it will load the page instead.