Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [Symfony][Symfony2] "Route "_wdt" does not exist."
PiotrekM
post 3.03.2012, 15:10:14
Post #1





Grupa: Zarejestrowani
Postów: 130
Pomógł: 6
Dołączył: 20.12.2009

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


Jestem w trakcie poznawania Symfony i natknąłem się na błąd.
W ramach nauki pisze prosty blog.
W moim kontrolerze renderuje widok z listą postów - wszystko jest ok.
Postanowiłem dać jakiś główny szablon, w tym celu stworzyłem plik layout.html.twig w folderze src/Milek/BlogBundle/Resources/views/ - jego zawartość:
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  3. <head>
  4. <meta name="author" content="Luka Cvrk" />
  5. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  6. <title>INTERACTIVE MEDIA using media to broadcast content</title>
  7. </head>
  8. <body id="home">
  9. {% block content %}
  10. {% endblock %}
  11. </body>
  12. </html>


zawartość pliku src/Milek/BlogBundle/Resources/views/Post/index.html.twig:
  1. {# src/Milek/BlogBundle/Resources/views/Post/index.html.twig #}
  2. {% extends "MilekBlogBundle::layout.html.twig" %}
  3.  
  4. {% block content %}
  5. {% for post in posts %}
  6. <div class="post">
  7. <div class="header"><a href="{{ path('post_show', { 'slug': post.getSlug() }) }}">{{ post.getTitle() }}</a></div>
  8. <div>{{ post.getContent() }}</div>
  9. </div>
  10. {% endfor %}
  11. {% endblock %}


A to treść wyjątku:
Cytat
An exception has been thrown during the rendering of a template ("Route "_wdt" does not exist.") in WebProfilerBundle:Profiler:toolbar_js.html.twig at line 11.


Sprawa jest o tyle dziwna, że gdy usunę z pliku layout.html.twig dwie ostatnie linie, to wszystko jest ok.

Ok - poradziłem sobie. Wystarczyło w pliku routing_dev.yml dać kod który usunąłem wcześniej, czyli:
Kod
_assetic:
    resource: .
    type:     assetic

_wdt:
    resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml"
    prefix:   /_wdt

_profiler:
    resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml"
    prefix:   /_profiler

_configurator:
    resource: "@SensioDistributionBundle/Resources/config/routing/webconfigurator.xml"
    prefix:   /_configurator

_main:
    resource: routing.yml
Go to the top of the page
+Quote Post

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 Wersja Lo-Fi Aktualny czas: 6.07.2025 - 06:45