Render a php file without a template system

what’s the best way to render a regular php file without installing a template system in slim ?
Should I just use php ‘include’ ?

You could just include files, but that is a bad idea. A better approach would be to create namespaced classes for your templates which then either

  1. Read a HTML file based on some parameter and return it


  1. Implement a function which returns HTML

I would view both these approaches as sub-optimal; unless you have very good reasons, there really is no reason not to use a template engine these days.

thanks for your answer.
Do you know if it is possible to indicate multiple template directories when using the PHP-view template system ?
I couldn’t see examples with this renderer.

I don’t think you can set multiple template directories for one renderer, although you can alter the template path for a given renderer using setTemplatePath.

If you want to place templates in separate folders, you can use subfolders. When the PhpRenderer::render is called for the template users/index.phtml, it will look for index.phtml in the users subfolder of the template path.

Another option would be to create multiple renderers, each with its own templatePath.