cannot load js and css assets #16074
-
My repositoryI just started on Phalcon, so the issue might be unrelated to Phalcon's version. <?php
use Phalcon\Mvc\Controller;
class IndexController extends Controller
{
public function indexAction()
{
$this->assets->addCss('css/global.css');
$this->assets->addJs('js/global.js');
}
} index.phtml <html>
<head>
<?php $this->assets->outputCss(); ?>
</head>
<body >
// a lot of stuff here
<?php $this->assets->outputJs(); ?>
</body>
</html> Overall structure:
My index outputMy index page on the inspector (Elements) <!-- I removed the rest of the page code -->
<link rel="stylesheet" type="text/css" href="/css/global.css">
<script type="application/javascript" src="/js/global.js"></script> Each containing this (Sources)
And no error output on the Console. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
There seems to be a problem with your rewrite rules (.htaccess). The app tries to interpret the paths for your assets as controller paths. Try changing a bit your code to something like: $this->assets->addCss('random/global.css'); and see that you get in the output
If after that your message is |
Beta Was this translation helpful? Give feedback.
-
Yes, the message was indeed |
Beta Was this translation helpful? Give feedback.
There seems to be a problem with your rewrite rules (.htaccess). The app tries to interpret the paths for your assets as controller paths.
Try changing a bit your code to something like:
and see that you get in the output
If after that your message is
RandomController handler class cannot be loaded
then it is a rewrite rule issue for sure.