0

I am trying to display a symfony template using php..However, symfony is treating my php tags as "comments"

My controller

namespace Acme\testBundle\Controller;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class testController extends Controller
{
    public function helloAction()
    {
        //return new Response('Created product id ');

        return $this->render('AcmetestBundle:test:test.html.php');
    }
}

My template : test.html.php

<?php var_dump("Hello world");?>

My output :

<!--?php var_dump("Hello world");?-->

How can I fix this?

3 Answers 3

7

Probably just need to add php as a template engine to your config file.

templating: { engines: ['twig','php'] }
Sign up to request clarification or add additional context in comments.

1 Comment

Yes. Here's the link to the documentation: symfony.com/doc/current/cookbook/templating/PHP.html
0

Did you google for this?

First result for "Symfony2 PHP template": http://symfony.com/doc/2.0/cookbook/templating/PHP.html

Comments

0

any more suggestions? Enabled twig as Cerad suggested, cleared cache. Still keep getting

<!--?php var_dump("Hello world");?-->

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.