skip to Main Content

I am using Plesk for my project. It works fine when I render a twig file but when I render a php file in my Controller an error occurred:

 "The template "::/var/www/vhosts/domain/httpdocs/project/templates/test.php" does not exist."

This is my code:

$this->render('/var/www/vhosts/domain/httpdocs/project/templates/test.php');

2

Answers


  1. Chosen as BEST ANSWER

    I added in framework.yaml templating: engines: ['twig', 'php'] So that I can reder a php file as mention in the documentation https://symfony.com/doc/current/templating/PHP.html


  2. $this->render('/var/www/vhosts/domain/httpdocs/project/templates/test.php');
    

    The above code is wrong in symfony. render function (used in the controller) is used for rendering twig file content. The above code gives the result like that

    No engine is able to work with the template "/var/www/vhosts/domain/httpdocs/project/templates/test.php"
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search