# |
Feb 12th 2020, 20:07 |
sebastian.krzewinski. |
https://i.imgur.com/IYdbAMf.png |
# |
Feb 12th 2020, 20:06 |
sebastian.krzewinski. |
5 and now i have this |
# |
Feb 12th 2020, 20:06 |
sebastian.krzewinski. |
4. i created folder under webroot named "admin" to have paste my files from my project |
# |
Feb 12th 2020, 20:06 |
phantomwatson |
The problem might be that in `routes.php`, your prefix is "Admin" (capitalized) when it should be "admin" (lowercase). |
# |
Feb 12th 2020, 20:04 |
sebastian.krzewinski. |
3. to load /admin page |
# |
Feb 12th 2020, 20:03 |
sebastian.krzewinski. |
2. localhost/admin |
# |
Feb 12th 2020, 20:03 |
sebastian.krzewinski. |
https://i.imgur.com/Zp9pEQK.png |
# |
Feb 12th 2020, 19:58 |
phantomwatson |
Could you explain it like this? 1. How are your files/routing set up? 2. What URL did you try to load? 3. What specifically did you expect to happen? 4. What actually happened? |
# |
Feb 12th 2020, 19:57 |
sebastian.krzewinski. |
localhost/admin |
# |
Feb 12th 2020, 19:57 |
sebastian.krzewinski. |
no im trying open the website/page |
# |
Feb 12th 2020, 19:56 |
phantomwatson |
Am I correct that when you try to open a file like `/webroot/foldername/file.ext` by going to the URL `/foldername/file.ext` it instead redirects you to the URL `/webroot/foldername/file.ext`? |
# |
Feb 12th 2020, 19:54 |
sebastian.krzewinski. |
becouse redirect me to /webroot/foldernameserver |
# |
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 |