Open DarkSide666 opened 6 years ago
url() has never worked for nested pages. If you think about it, without a proper router that is able to determine root of the project it's not even possible.
I suggest to workaround with this:
function url(..) {
return '/path/to/app/'.parent::url(..);
}
Well... maybe. But that makes App->url() usable only for quite limited use-cases and tiny projects where all pages are in same hierarchy level :(
well that's how it is. We can always integrate a router+front controller+location-aware url through an add-on. We can have a hook inside url to fully override it or perhaps even extend App.
Remember that this logic is NOT required in integration with Wordpress.
some work started in https://github.com/atk4/ui/blob/d8b145f8/src/App.php#L633
repro:
var_dump($app->url(__FILE__));
I think we can detect absolute path easily and run it thru App::createRequestPathFromLocalPath()
Current page URL:
/invoices/sale.php
$cb->getURL() returns
/sale.php?...callback...parameters...
, but should return/invoices/sale.php?...
That's because in Api->url() it calculates $this->page as basename($uri) = 'sale' and if $page[0] page url is not explicitly passed (like callback getURL() does) it returns $page[0] = $this->page = basename($uri) = 'sale'. I expect invoices/sale here not basename.