1

A started to work with Phalcon framework, included Blade templating. It's already works, but unfortunately i didn't find the right way to include css and JS assets in master.blade.php. If I add the assets like $this->assets->addCss("css/bootstrap.min.css"); in the controller I can not include it in the master template file.

For example, my indexAction looks like this:

public function indexAction(){  
    $this->assets->addCss("css/bootstrap.min.css");
    $this->assets->addJs("js/bootstrap.min.js");
    return $this->blade->make('index.index');  
}

Thanks for any help!

1 Answers1

1

Well - you should add blade as actual template engine into phalcon view.

Your class should extends Engine implements EngineInterface. If you will do it it could be nice to add it to incubator repository.

https://github.com/phalcon/incubator/tree/master/Library/Phalcon/Mvc/View/Engine check out implementation of other engines for more how are they made. Then you could just do {{ assets.outputJss() }}, example from volt/twig, not sure how exactly it should look like in blade, never used it.

Also what's wrong with volt? It's faster than blade and have many features.

Juri
  • 1,369
  • 10
  • 16
  • 1
    I heard that blade is better than Volt, because of this I wanted to do this. :) But now I think it was not a good idea. :) Thank you for your answer. – Boldogh Gergő May 10 '17 at 10:23
  • 1
    I am not telling it's a bad idea to use blade, but give a try to volt, then if you think it has some issues or it's not enough switch to other. – Juri May 11 '17 at 11:47
  • Now I decided to use volt instead of Blade. Blade is good, but I think volt is also good enough :) I'm new in both of these templating stuffs... :) – Boldogh Gergő May 17 '17 at 11:01