0
votes

Hello I want to render a template without controller. I define the route in routing.yml:

form:
path: /form/
defaults:
    _controller: FrameworkBundle:Template:template
    template: 'TechappStatsBundle:Stats:form.html.twig'

And in my twig:

    <button href="{{ path('form') }}" class="btn btn-info btn-lg pull-right">
         <span class="glyphicon glyphicon-plus"></span> Ajouter un bloc 
    </button>

But when I click, I have "An exception has been thrown during the rendering of a template ("Unable to generate a URL for the named route "form" as such route does not exist.")"

Thanks for your help =)

1
Looks like and indentation problemMed
where? in my twig path and default are correctSlimZ

1 Answers

0
votes

It seems that your route is not well defined in the YAML file. Change its definition by the following:

form:
    path: /form/
    defaults:
        _controller: FrameworkBundle:Template:template
        template: 'TechappStatsBundle:Stats:form.html.twig'

Please note that YAML files require an strict indentation based on four white spaces.