Routing problem

Hi,

I'm having a problem with my css and javascript files. If I'm at the root of my app, the css and the JS looks fine and they url looks like that : http://localhost/maestro/js/jquery.min.js

But, if I'm going in another controller it goes like this :

http://localhost/maestro/session/js/jquery.min.js

And all my design is mess-up. Does anyone knows why the controller is added to my css and JS files URL ?

Thank you.

Show you infrx.phtml (volt) template code



16.5k

Hi, here you have it : [code] <!DOCTYPE html> <html class="uk-height-1-1"> <head> <meta charset='utf-8'> <?php echo Phalcon\Tag::getTitle(); ?> <LINK href="css/uikit.almost-flat.min.css" rel="stylesheet" type="text/css"> <LINK href="css/site.css" rel="stylesheet" type="text/css"> </head> <body class="uk-height-1-1"> {{ content() }} <script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript" src="js/uikit.min.js"></script> </body> </html> [/code]

change: ```html href="css/uikit.almost-flat.min.css" => href="/css/uikit.almost-flat.min.css" src="js/jquery.min.js => src="/js/jquery.min.js ``` etc.



16.5k

Hi, this did not fix the problem. Actually, it is worst. I lost all the style.



81.3k

You need to use the absolute url helper:

<LINK href="<?php echo $this->url->getStatic("css/uikit.almost-flat.min.css") ?>" rel="stylesheet" type="text/css">
<LINK href="<?php echo $this->url->getStatic("css/site.css") ?>" rel="stylesheet" type="text/css">


16.5k

Hi, thanks for all your answer. That fix the problem. Thank You !