thephpleague / plates

Native PHP template system
https://platesphp.com
MIT License
1.47k stars 180 forks source link

Correct way for loading assets #243

Closed realrecordzLab closed 5 years ago

realrecordzLab commented 5 years ago

I'm reading the documentation, but i've not clear how to load all my assets files. I've noticed that if I set the correct path for my css and js files, they will not be loaded.

here is my code. Any suggestion and explaination will be appreciated.

define('ROOT', __DIR__); // this constant is defined inside my front controller
// this is how I'm loading the asset method inside the controller class
$this->view = new \League\Plates\Engine( ROOT.'/assets/templates' );
$this->view->loadExtension(new \League\Plates\Extension\Asset( ROOT, true));

view file

<link rel="stylesheet" href="<?php echo $this->asset(/assets/css/bootstrap.min.css); ?>" type="text/css">

I've got this error:

/assets/css/bootstrap.min.1545385632.css - No such file or directory

Dexarys commented 5 years ago

Hello, I have the same error as you.. The Engine finds my file but not the navigator. Have you found a solution ?