I am a beginner in Symfony2. I have created my first template and I can access to it through the URL http://localhost/mylibrary-web/web/app_dev.php/hello/Test.
Here the content of my src/MyLibrary/LibraryBundle/Resources/views/Default/index.html.twig
file :
Hello {{ name }}!
I do not have the toolbar (because I do not have the </body>
element, but if I update the index.html.twig
file with :
<html>
<body>
Hi {{ name }}!
</body>
</html>
nothing changes. These modifications are not considered. The old content is still display when I call the URL http://localhost/mylibrary-web/web/app_dev.php/hello/Test.
I tried to clear the cache with the command line php app\console cache:clear
. I also tried to hard delete the cache by deleting the app\cache
directory. Finally, I tried to add the following line to the config_dev.yml
file :
twig:
cache: false
Unfortunately, nothing changes, I still have the old content displayed.
Am I missing something to update the twig file ?
Thank you in advance for your help !
Edit :
Here the code of the src/MyLibrary\LibraryBundle\Controller\DefaultController.php
file :
<?php
namespace MyLibrary\LibraryBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class DefaultController extends Controller
{
public function indexAction($name)
{
return $this->render('MyLibraryLibraryBundle:Default:index.html.twig', array('name' => $name));
}
}
and the result of the command line php app\console route:debug
:
[router] Current routes
Name Method Scheme Host Path
_wdt ANY ANY ANY /_wdt/{token}
_profiler_home ANY ANY ANY /_profiler/
_profiler_search ANY ANY ANY /_profiler/search
_profiler_search_bar ANY ANY ANY /_profiler/search_bar
_profiler_purge ANY ANY ANY /_profiler/purge
_profiler_info ANY ANY ANY /_profiler/info/{about}
_profiler_phpinfo ANY ANY ANY /_profiler/phpinfo
_profiler_search_results ANY ANY ANY /_profiler/{token}/search/results
_profiler ANY ANY ANY /_profiler/{token}
_profiler_router ANY ANY ANY /_profiler/{token}/router
_profiler_exception ANY ANY ANY /_profiler/{token}/exception
_profiler_exception_css ANY ANY ANY /_profiler/{token}/exception.css
_configurator_home ANY ANY ANY /_configurator/
_configurator_step ANY ANY ANY /_configurator/step/{index}
_configurator_final ANY ANY ANY /_configurator/final
_twig_error_test ANY ANY ANY /_error/{code}.{_format}
my_library_library_homepage ANY ANY ANY /hello/{name}
homepage ANY ANY ANY /app/example
Edit 2 :
Here the definition of the my_library_library_homepage route :
my_library_library_homepage:
path: /hello/{name}
defaults: { _controller: MyLibraryLibraryBundle:Default:index }
and here the result when I grep Hello {{ name }}!
:
- C:\wamp\www\mylibrary-web\vendor\sensio\distribution-bundle\Sensio\Bundle\DistributionBundle\Resources\skeleton\acme-demo-bundle\Acme\DemoBundle\Resources\views\Demo\hello.html.twig
- C:\wamp\www\mylibrary-web\vendor\sensio\distribution-bundle\Sensio\Bundle\DistributionBundle\Resources\skeleton\acme-demo-bundle\Acme\DemoBundle\Resources\views\Secured\hello.html.twig
- C:\wamp\www\mylibrary-web\vendor\sensio\generator-bundle\Sensio\Bundle\GeneratorBundle\Tests\Generator\BundleGeneratorTest.php
- C:\wamp\www\mylibrary-web\vendor\twig\extensions\doc\i18n.rst
- C:\wamp\www\mylibrary-web\vendor\twig\twig\doc\api.rst
- C:\wamp\www\mylibrary-web\vendor\twig\twig\doc\intro.rst