Book Image

Learning Phalcon PHP

Book Image

Learning Phalcon PHP

Overview of this book

Table of Contents (17 chapters)
Learning Phalcon PHP
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Assets management


Before going further, I would like to introduce you to Phalcon's assets manager. This is a very useful component when you need to handle lots of assets (in general, CSS files, images, and JavaScript files). The service should already be available, and you can access it via DI using the following command:

$manager = $this->assets;

Otherwise, you can use the following command:

$manager = $this->getDI()->get('assets');

Note

I've heard some people complaining that after its installation, this service does not exist. If you are using Phalcon version 1.3.* (and you should be), then you wouldn't have any problem. If you use an older version, you might need to inject this service into the DI:

$di->set('assets', function () {
    return new Phalcon\Assets\Manager();
}, true);

Now, let's open the main layout for the back office and do some changes. Open modules/Backoffice/Views/Default/layout.volt and remove all the lines containing stylesheetLink and javascriptInclude.

Now...