Log message #4226612

# At Username Text
# Feb 12th 2020, 19:54 sebastian.krzewinski. after /
# Feb 12th 2020, 19:53 sebastian.krzewinski. i cant open any director
# Feb 12th 2020, 19:53 sebastian.krzewinski. if i create folder under webroot
# Feb 12th 2020, 19:53 sebastian.krzewinski. im trying to say
# Feb 12th 2020, 19:52 sebastian.krzewinski. cake 4
# Feb 12th 2020, 19:51 phantomwatson Are you using CakePHP 3 or CakePHP 4?
# Feb 12th 2020, 19:51 phantomwatson You asked > in futere i want to have folder where be my media files like pdf/movies etc. how can i do this? and you do that by putting those files under `/webroot`. Is there something else that's unclear about how to serve those files?
# Feb 12th 2020, 19:51 sebastian.krzewinski. in templates/pages
# Feb 12th 2020, 19:50 phantomwatson Where is the `home.php` file in your site?
# Feb 12th 2020, 19:50 sebastian.krzewinski. i know that
# Feb 12th 2020, 19:50 phantomwatson Media files should be placed under `/webroot` with files like `/webroot/css/style.css` accessed by the URL `example.com/css/style.css`.
# Feb 12th 2020, 19:50 sebastian.krzewinski. no
# Feb 12th 2020, 19:48 phantomwatson @sebastian.krzewinski., there's a lot to unpack there... Are you intending to route the path `/` to the file `/webroot/home.php`?
# Feb 12th 2020, 19:46 lpj145 particular a like the deploy.sh example.
# Feb 12th 2020, 19:46 sebastian.krzewinski. @phantomwatson i dont get it. for "/" i have home.php. to create front page, "/admin" is prefix where i use /layout/default.php to create front of admin panel. in futere i want to have folder where be my media files like pdf/movies etc. how can i do this?
# Feb 12th 2020, 19:45 lpj145 congratulations @dereuromark the sandbox have good tips for devs.
# Feb 12th 2020, 19:44 ndm @MrEm Kinda depends on what the code that uses `$events` does/expects. You could just pass `null` and test for that later on accordingly, or maybe pass an empty collection (`collection([])`). Obtaining an empty result set without running an actual query is probably a llittle cumbersome.
# Feb 12th 2020, 19:36 MrEm like: if (empty($ids)) { /* $events = ?? */ } else { $events = $this->Events->find('all', [ /* ... */]); }
# Feb 12th 2020, 19:35 MrEm I have a find('all') query that I'm basing on an IN (array) condition. If I have an empty set for my array, how can I build the same thing as I would get from a find('all'), but have it be empty?
# Feb 12th 2020, 19:31 ndm Again, if you're being redirected to `.../webroot/...` then you usually have URL rewriting issues of some sort
# Feb 12th 2020, 19:30 ndm It's less that CakePHP (the framework) assumes that, but the default app's rewrite rules do check for the existence of a file with the given path first, irrespective of what the path is
# Feb 12th 2020, 19:30 sebastian.krzewinski. hm
# Feb 12th 2020, 19:27 phantomwatson If your path includes a file extension, like `/admin.php`, then CakePHP will assume that you're trying to load a file by that name located under `/webroot`. This is appropriate for non-PHP files, and for edge cases like Google's domain ownership verification files.
# Feb 12th 2020, 19:25 slackebot under `/webroot`.
# Feb 12th 2020, 19:25 phantomwatson As long as your server has your domain's document root set to `/webroot` and as long as it loads `index.php` by default, all requests will go there, and the path in the URL (like `/admin`) will be passed along to `index.php` as part of the `$request` object. Loading a file other than `index.php` is kind of stepping outside of how the framework works. I recommend that you just use the Router and to put your pages under `/src` instead of
# Feb 12th 2020, 19:23 sebastian.krzewinski. https://i.imgur.com/ewxZNCS.png
# Feb 12th 2020, 19:23 sebastian.krzewinski. to use another folders
# Feb 12th 2020, 19:23 sebastian.krzewinski. in routes
# Feb 12th 2020, 19:22 sebastian.krzewinski. now i see i need to have asset urls
# Feb 12th 2020, 19:22 sebastian.krzewinski. exacly i have this
# Feb 12th 2020, 19:22 phantomwatson I think you'll need to add this to your `/config/routes.php` file like this: ```Router::prefix('admin', function (RouteBuilder $routes) { $routes->connect('/', ['controller' => 'Pages', 'action' => 'index']); }```
# Feb 12th 2020, 19:21 sebastian.krzewinski. i have route set to /admin but isnt work if i create something in webroot
# Feb 12th 2020, 19:20 phantomwatson It sounds like you want the URL `localhost/admin` to be routed to something. Check out the documentation about the Router class in https://book.cakephp.org/3/en/development/routing.html.
# Feb 12th 2020, 19:20 sebastian.krzewinski. i need to create routes?
# Feb 12th 2020, 19:18 sebastian.krzewinski. where i editi default index
# Feb 12th 2020, 19:17 sebastian.krzewinski. its should be working but again i have problem with redirection .. after creating folder in webroot and copy/past my files i cant join to localhost/admin
# Feb 12th 2020, 19:11 phantomwatson It's okay! It's difficult to learn a new framework. Just keep working, and you'll understand it better every day.
# Feb 12th 2020, 19:10 sebastian.krzewinski. sorry for my problems, i just want to learn cakephp :)
# Feb 12th 2020, 19:09 sebastian.krzewinski. i will try it
# Feb 12th 2020, 19:09 sebastian.krzewinski. ok thanks
# Feb 12th 2020, 19:09 sebastian.krzewinski. aaaaa