I want to change render path of twig. I am using twig with codeigniter. my code is below:
$loader = new Twig_Loader_Filesystem(FCPATH.'themes/site/default');
$twig = new Twig_Environment($loader);
$twig->load('layout.twig.php');
echo $twig->render(APPPATH.'views/site/welcome.twig.php', $data);
But code is giving error:
Type: Twig_Error_Loader
Message: Unable to find template "/var/www/html/test.ab/application/views/site/welcome.twig.php" (looked into: /var/www/html/test.ab/themes/site/default).
Filename: /var/www/html/test.ab/vendor/twig/twig/lib/Twig/Loader/Filesystem.php
Line Number: 232
$loader = new Twig_Loader_Filesystem(FCPATH.'themes/site/default'); $twig = new Twig_Environment($loader); echo $twig->render('welcome.twig.php', $data);
视图文件是相对于FCPATH的。'themes / site / default'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.