We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Routing problem


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 :


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


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]


href="css/uikit.almost-flat.min.css" => href="/css/uikit.almost-flat.min.css" 
src="js/jquery.min.js =>  src="/js/jquery.min.js



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


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


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