php-mvc
php-mvc copied to clipboard
Javascript and CSS include errors
I am trying to create a router with the Path: localhost/user/login. Here is an example how I try to do it: $router->add('user/login', ['controller' => 'LoginController', 'action' => 'login']);
It also works but I get include errors from Javascript freamworks and CSS. See the picture.

Includes in the twig file:
... ...If I only use e.g. "login" as path the frameworks are included.
$router->add('user/login', ['controller' => 'LoginController', 'action' => 'login']);
The URLs for your included files need to be based on the path to the public folder - so for example if you have a file pubic/css/main.css, you would include it like this:
<link rel="stylesheet" href="/css/main.css">
If you have the framework in a subfolder, you need to include that too:
<link rel="stylesheet" href="/appmvc/css/main.css">