Hi,
I started to work on a Phalcon project and my question it is, where I can load the Assets like addJs or addCss.
I added this on ControllerBase, something like this:
class ControllerBase extends Controller {
public function onConstruct()
{
$this->view->setVar('logged_in', is_array($this->auth->getIdentity()));
$router = $this->router->getControllerName();
$this->assets->addCss('css/style.css');
$this->assets->addJs('https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js');
if($router == "users")
{
$this->assets->addJs('js/users/index.js');
}
if($router == "articles")
{
$this->assets->addJs('js/articles/index.js');
}
if($router == "realtime")
{
$this->assets->addJs('js/realtime/index.js');
}
}
How do you all implement this? I don't know what's the correct way to do this.
Thanks!