title: Different views according to url in symfony2?
body: <p>Suppose in my twig file I have following codes. Everything is working fine how to have different view if I click page number in Pagination tab.
  When I click page no2 it should have different output. Eg </p>
  
  <pre><code>&lt;p&gt; This is page no2&lt;/p&gt;
  </code></pre>
  
  <p><strong>My url</strong>
  <a href="http://localhost/project/web/app_dev.php/funfact/2" rel="nofollow noreferrer">http://localhost/project/web/app_dev.php/funfact/2</a>
  When I check current url using</p>
  
  <pre><code>    {% if app.request.attributes.get('_route') == 'funfact/2' %}
  &lt;/p&gt;    this is page no 2&lt;/p&gt;
      {%endif%}
  </code></pre>
  
  <p>it is not giving the above output.    </p>
  
  <p>How do I match current url with <a href="http://localhost/project/web/app_dev.php/funfact/2" rel="nofollow noreferrer">http://localhost/project/web/app_dev.php/funfact/2</a>  </p>
  
  <p>Also in Phpstorm its giving me Alias 'Sensio\Bundle\FrameworkExtraBundle\Configuration\Route' is never used</p>
  
  <p><strong>In my twig view.html.twig</strong> 
   <p> This is page 1</p></p>
  
  <pre><code>&lt;div class="row"&gt;
  &lt;ul class="pagination pagination-lg"&gt;
      &lt;li&gt;&lt;a href="#"&gt;&amp;laquo;&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#"&gt;1&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="{{ path('funfact', {'page': '2'}) }}"class="active"&gt;2&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="{{ path('funfact', {'page': '3'}) }}"class="active"&gt;3&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#"&gt;&amp;raquo;&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>routing.yml:</strong></p>
  
  <pre><code>funfact:
      path:     /funfact/{page}
      defaults: { _controller: HomeBundle:FunFact:funView, page: 1  }
  </code></pre>
  
  <p><strong>Controller Class</strong></p>
  
  <pre><code>class FunFactController extends Controller
  {
      /**
       * @Route("/funfact/{page}"),defaults={"page" = 1})
       */
      public function funViewAction($page)
      {
        return $this-&gt;render('HomeBundle::funfact.html.twig');
      }
  }
  </code></pre>