Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP + Symfony] Menu ze slugami i dynamiczny routing
dopelganger
post
Post #1





Grupa: Zarejestrowani
Postów: 236
Pomógł: 0
Dołączył: 27.10.2012

Ostrzeżenie: (0%)
-----


cześć
nie wiem jak zrobić aby tworzyły się dynamiczne linki w menu ze slugiem (np: /o-firmie), kiedy je odczytuje to mam dziwną postać w źródle: web/app_dev.php/%7B%24slug%7D?slug=o-firmie

a kiedy klikam taki link to wywala błąd:
Controller "FrontBundle\Controller\DefaultController::pageAction()" requires that you provide a value for the "$slug" argument (because there is no default value or because there is a non optional argument after this one).


Builder.php

  1. $menu->addChild($c->getLabel(), array(
  2. 'route' => 'page',
  3. 'routeParameters' => array('slug' => $c->getLink())
  4. ));


DefaultController.php

  1. /**
  2.   * @Route("/{$slug}", name="page")
  3.   * @Template("FrontBundle:Page:page.html.twig")
  4.   */
  5. public function pageAction($slug)
  6. {
  7. return array();
  8. }


Prosze o pomoc

Ten post edytował dopelganger 21.06.2016, 13:01:44
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 21.08.2025 - 01:19