My application has a
base.phtml file that is the basis for all pages. I'm writing some documentation and I'd like to re-use that template. The PHP file that will be used to display the documentation is outside the main
/app directory. I think I could probably include the
bootstrap.php file and get things working, but that seems like an awful lot of work and resources simply to render a template.
$View = new \Phalcon\Mvc\View\Simple(); $View->setDI(new Phalcon\DI\FactoryDefault()); $View->registerEngines(['.phtml'=>Phalcon\Mvc\View\Engine\Volt::class]); echo $View->render('../../../app/views/partials/base.phtml');
but then I get this error:
Warning: Phalcon\Mvc\View\Engine\Volt\Compiler::compileFile(../../../app/views/partials/base.phtml.php): failed to open stream: Permission denied in /var/www/htdocs/point/public/documentation/developer/parse.php on line 20
I tried using the raw Volt compiler, but it just generates the intermediate PHP code which I then need to
eval(), which I am loath to do.
Isn't there a simple way to just say "Here's my template file X, render it and give me the resulting HTML output"? I suppose the raw compiler is pretty close, but I'd like to be cleaner if possible.