![]() |
![]() |
![]() ![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 5 Pomógł: 0 Dołączył: 23.04.2015 Ostrzeżenie: (0%) ![]() ![]() |
Witam
jako że nie mogę napisać nowego tematu( w frameworki?) napiszę tutaj. Po instalacji i konfiguracji według str. KnpMenuBundle mam następujący błąd: Kod An exception has been thrown during the rendering of a template ("Unable to generate a URL for the named route "sprawdz" as such route does not exist.") in src/Firma/SerwisBundle/Resources/views/layout.html.twig at line 12. konfiguracja: Ubuntu14.04, apache2, php5, mysql /app/AppKernel.php Kod new Knp\Bundle\MenuBundle\KnpMenuBundle(), new AppBundle\AppBundle(), new Firma\SerwisBundle\FirmaStartBundle() /app/config/config.yml Kod # KnpMenuBundle Configuration knp_menu: twig: template: knp_menu.html.twig templating: false default_renderer: twig /app/config/routing.yml Kod firma: resource: "@FirmaStartBundle/Resources/config/routing.yml" prefix: / /app/config/services.yml Kod app.menu_builder: class: AppBundle\Menu\MenuBuilder arguments: ["@knp_menu.factory"] app.main_menu: class: Knp\Menu\MenuItem factory_service: app.menu_builder factory_method: createMainMenu arguments: ["@request_stack"] tags: - { name: knp_menu.menu, alias: main } /src/Firma/StartBundle/Resources/config/routing.yml Kod firma_start: path: / defaults: { _controller: FirmaStartBundle:Welcome:index } firma_info: resource: "@FirmaStartBundle/Controller/InfoController.php" type: annotation prefix: /info /src/Firma/StartBundle/Controller/InfoController.php Kod <?php namespace Firma\StartBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; class InfoController extends Controller { /** * @Route("/", defaults={"url"="info"}), * @Route("/{url}", name="firma_info") * @Template() */ public function indexAction($url) { //... return array("url" => $url); } } /src/AppBundle/Menu/MenuBuilder.php Kod <?php namespace AppBundle\Menu; use Knp\Menu\FactoryInterface; use Symfony\Component\HttpFoundation\RequestStack; class MenuBuilder { private $factory; /** * @param FactoryInterface $factory */ public function __construct(FactoryInterface $factory) { $this->factory = $factory; } public function createMainMenu(RequestStack $requestStack) { $menu = $this->factory->createItem('root'); $menu->addChild('Home', array('route' => 'test')); // ... add more children return $menu; } } Kod <td>{{ knp_menu_render('main') }}</td> jakieś pomysły? Męczę się z tym już 3 dzień, gdy odnośnik menu wskazuje na 'route' => 'homepage' wszystko działa, a gdy ma wartość inną już nie, coś z routingiem tylko nie wiem co, polecenie router:debug pokazuje firma_start ANY ANY ANY / firma_start_info_index ANY ANY ANY /info/ firma_info ANY ANY ANY /info/{url} Kombinuje na różne sposoby i nic (pewnie coś przeoczyłem:)). Ten post edytował karas77 17.05.2015, 15:03:39 |
|
|
![]() ![]() |
![]() |
Aktualny czas: 23.08.2025 - 03:46 |