title: Cakephp - Display list element inside if
body: <p>I'm currently displaying a list using cakephp, but I've been unable to redirect on clicking in an specific elemnt component which has to disappear in some cases, this is what I have:</p>
  
  <pre><code>&lt;li&gt;&lt;a href="&lt;?php echo $this-&gt;Url-&gt;build(["controller" =&gt; "pages","action" =&gt; "index"]);?&gt;"&gt;Top 20&lt;/a&gt;
  &lt;?php  
  $a = true;
    if($a){ 
      $prod_pm= '&lt;li&gt;&lt;a href="&lt;?= $this-&gt;Url-&gt;build(["controller" =&gt; "Catalogo","action" =&gt; "cat",11229])? 
      &gt;"&gt;Promotions&lt;/a&gt;'; 
    }else{
      $prod_pm = '';
  }?&gt;  
  &lt;?= $prod_pm ?&gt; 
  &lt;li&gt;&lt;a href="&lt;?= $this-&gt;Url-&gt;build(["controller" =&gt; "Catalogo","action" =&gt; "cat",11050]) ?&gt;"&gt;&lt;/a&gt;
  </code></pre>
  
  <p>It seems that the php redirected after the href citation is not working that way, also I tried declaring a variable with the code outside and inserting in place of <code>$this-&gt;Url-&gt;build(["controller" =&gt; "Catalogo","action" =&gt; "cat",11229])</code>
  but didn't work.</p>
  
  <p>Thanks in advance for any hint or help.</p>