AnchovyLegend
AnchovyLegend

Reputation: 12538

Not using templates Symfony 2

I am having a hard time finding anything on the topic. What if I wanted to use a controller to simply render a static page such as about.php? When I try the following I get a template not found error.

public function aboutAction()
{
    return $this->render('FooBundle:Default:about.php');
}

Upvotes: 0

Views: 95

Answers (1)

Emii Khaos
Emii Khaos

Reputation: 10085

You can render the page without creating a controller:

foo_about:
    path: /about
    defaults:
        _controller: FrameworkBundle:Template:template
        template: 'FooBundle:Default:about.html.php'

The about.html.php must be located under Resources/views/Default/ directory of the FooBundle.

See How to render a Template without a custom Controller

Upvotes: 2

Related Questions