I hope this is the right place to post this question, I am new to the Symfony2 and KnpLabs Communities.
I get this exception The function "menu" does not exist in AsvymMainBundle:Default:index.html.twig at line 6
This only happens when I add the twig tag {{ menu('main') }} to my view
With out this tag the page renders ok.
I have installed Symfony2 Beta 1 and Symfony profiler shows the KnplabsMenuBundle as an Active Bundle under CONFIG
I followed the document 03-Twig-Integration.markdown in the Resources/doc folder
Log from exception page is:
DEBUG [2011-05-21 16:46:28] event.DEBUG: Notified event "onCoreController" to listener "JMS\SecurityExtraBundle\Controller\ControllerListener".
DEBUG [2011-05-21 16:46:28] event.DEBUG: Notified event "onCoreException" to listener "Symfony\Bundle\FrameworkBundle\Profiler\ProfilerListener".
ERROR [2011-05-21 16:46:28] request.ERROR: Twig_Error_Syntax: The function "menu" does not exist in "AsvymMainBundle:Default:index.html.twig" at line 6 (uncaught exception)
DEBUG [2011-05-21 16:46:28] event.DEBUG: Notified event "onCoreRequest" to listener "Symfony\Bundle\FrameworkBundle\RequestListener".
DEBUG [2011-05-21 16:46:28] event.DEBUG: Notified event "onCoreRequest" to listener "Symfony\Bundle\FrameworkBundle\Profiler\ProfilerListener".
I see this What now? In the documentation?
You will need 5 steps to get to the point where you can just type in your Twig template:
{{ menu('main') }}
Create a Menu class:
did this in src/Asvym/MainBundle/Menu/MainMenu.php
created class MainMenu extends Menu ...
Declare a Menu service
create a menu.xml to declare your menu.main service
in src/Asvym/MainBundle/Resources/config/menu.xml
Load your Menu service in the Dependency Injection Extension
in Asvym\MainBundle\DependencyInjection\AsvymMainExtension.php added
$loader->load('menu.xml');
Enable the Dependency Injection for your bundle
Not shure what this part is
Render your menu with Twig
This is where I get error using {{ menu('main') }}
Thanks for the help
Mike