A question about bootstrapping assets

Hi, I have a multi module application ( 2 Modules - frontend and backend ) I followed the documentation about assets but now I have a few follow up questions :

  1. Where should i put the php file with the assets inside? Must it be in my /app folder?
  2. How does it get loaded ( bootstrapped ) into my main app?

Kind Regards



30.0k

Hi,

phalcon's assets system is your friend.

1/ assets ressources can be local => in public folder or external => cdn or so

2/ if you want to use differents styles for your modules frontend and backend, you can register your assets in each module ControllerBase class in function initialize(). Also, you may set a layout file there. Asset output is managed in these layouts files with code:

<?php $this->assets->outputCss() ?>
<?php $this->assets->outputJs() ?>

//or in case of collections (a really cool feature)
<?php $this->assets->outputJs('footer') ?>

Note that you can add ressource to collection on controller action level