php - Twig is not able to load assets -


i'm trying slim slim-extras , twig. problem can't include css or js files twig html. accessing css , js file directly browser give 404 not found error browser console throws 404 page error.

here httdocs(folder structure)

enter image description here

my apache document root /var/www/devdomain.dev/public , directoryindex index.php

this index.php in public folder

here tried add hook $app->hook , pass twig did not work.

<?php  require '../vendor/autoload.php';  // prepare app $app = new \slim\slim(array(     'templates.path' => '../templates', ));  // create monolog logger , store logger in container singleton  // (singleton resources retrieve same log resource definition each time) $app->container->singleton('log', function () {     $log = new \monolog\logger('slim-skeleton');     $log->pushhandler(new \monolog\handler\streamhandler('../logs/app.log', \monolog\logger::debug));     return $log; });  $app->hook('slim.before', function () use ($app) {     $app->view()->appenddata(array('baseurl' => 'templates/')); });  // prepare view $app->view(new \slim\views\twig()); $app->view->parseroptions = array(     'charset' => 'utf-8',     'cache' => realpath('../templates/cache'),     'auto_reload' => true,     'strict_variables' => false,     'autoescape' => true ); $app->view->parserextensions = array(new \slim\views\twigextension());   // define routes $app->get('/', function () use ($app) {     // sample log message     $app->log->info("home-page '/' route");     // render index view     $app->render('index.phtml'); });  // run app $app->run(); 

so question is: how pass template path or asset path twig slim?

edit: if css or js files in public folder can included.

in opinion setup. browser on index.php , search assets can't find them - because not on vhost.

right physically there when apache starts in public folder browser can not out of there. assets have public (or directly "echo-ed" template).


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -