Customising folder paths breaks Panel behaviour #447
Comments
I'm not too sure how to fix this, but I got the following: The error can be traced back to the public function index() {
if(isset($this->index)) return $this->index;
if(r::cli()) {
return $this->index = '/';
} else {
return $this->index = url::base() . preg_replace('!\/index\.php$!i', '', server::get('SCRIPT_NAME'));
}
} In case of your custom folder setup, Now I am wondering if it would be a solution to also preg_replace a potential |
Right now this is only fixable if you set the $kirby->urls->index manually before defining the other urls. It's more complicated to auto-detect this than it seems, so I'm postponing this for now. |
Thanks guys for addressing this. I've set |
Glad I found this issue, I lost a couple hours trying to figure out what was going wrong. If this can't be fixed in the next release, may I suggest adding to the docs that we have to set |
I also lost a couple hours searching what was wrong ! Definitly it will be nice to add the fix to the doc, in custom folder documentation page. |
+1 |
would be nice to use config and not setting it hardcoded. am i missing something? config.localhost.php
i added this to my custom site.php
|
@bnomei how about something along the lines of $kirby = kirby();
// $kirby->urls->index = url::scheme() . '://' . server::get('HTTP_HOST');
$kirby->urls->index = server::get('REMOTE_HOST'); // if this doesn't output protocol and port (can't remember), you could instead try HTTP_HOST and stitch it together with protocol and port
$kirby->roots->content = $kirby->roots()->index() . DS . 'data'; // changing the directory
$kirby->urls->content = $kirby->urls()->index() . DS . 'data'; // changing the url |
when entering url: REMOTE_HOST does nothing to fix it HTTP_HOST duplicates the output in both cases root does work correctly do i need the custom site.php in both / and /panel/ ? |
Previously the Panel would break if `kirby()->urls()->index()` was called (not set!) inside the `site.php` file for custom folder setups. The reason behind this is that the `index()` method caches its result and then the Panel's `index.php` would think that the URL has been set manually and not apply the URL fix. This commit together with getkirby/kirby#477 fixes this behavior by checking instead if the URL has been detected or really set manually. This is a more reliable approach here.
There is now finally a fix for this, see #887. Please test if my code changes for both the Panel and Kirby (see getkirby/kirby#477) work for you. This will then be included in the next Kirby release. |
…etup Fix #447: Proper support for custom folder setup
The fix for this will be included in Kirby 2.3.1. You don't need to manually set the index URL anymore with the fix. |
Still seems like you need to define Urls turns into this: when they should really be: |
Could you please post your |
This is my
I moved back the content folder so it was still in the same folder as my site.php but it wouldn’t make a difference. |
The last fix in Kirby 2.3.1 fixed only parts of the issue. If users get the value of $kirby->urls()->index() inside the site.php, the URL would still be incorrect. By moving the fix directly into the Kirby Url class, it is applied immediately.
You are right. I apparently only fixed parts of this issue in Kirby 2.3.1. |
Hi again! (and sorry for my two deleted posts since I clearly forgot about what was the problem in the first place :-p) |
Thanks for your reply. The fix is already in the latest Kirby release, Kirby 2.3.2. :) |
Tested there too now, works perfect! 👍 |
Hey all,
I've had an issue with Panel not loading and presenting a blank page after configuring paths in
$kirby->roots
and$kirby->urls
to tweak my project folder structure according to the documentation.site.php
I've tried other folder locations and isolating one set of changes at a time, but _any_ path modification seems to break the Panel, and each time the referenced directories were present and correct.
When inspecting the blank Panel page with
site.php
active it is trying to load assets from a different URL:http://localhost/projects/kirby-starter/panel/panel/assets/css/panel.css
(with path changes)http://localhost/projects/kirby-starter/panel/assets/css/panel.css
(normal)For some reason there is an additional
panel/
in the path. Interestingly, if I then visithttp://localhost/projects/kirby-starter/panel/panel/
, part of the Panel markup does load.As a first-party plugin, these global configuration changes ought not to break things :\ and I would prefer not hacking to fix this, as I have Panel included as a Git submodule. Also I'd hope that subsequent uploads through the Panel will respect the updated paths.
Many thanks.
Original Kirby forum question ↗
The text was updated successfully, but these errors were encountered: