php-mvc icon indicating copy to clipboard operation
php-mvc copied to clipboard

Javascript and CSS include errors

Open Movo-Burhan opened this issue 5 years ago • 1 comments

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.

image

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']);

Movo-Burhan avatar Oct 18 '20 08:10 Movo-Burhan

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">

daveh avatar Oct 19 '20 08:10 daveh