title: How to dynamically set og:image meta tag with php in joomla?
body: <p>I'm trying to dynamically set the og:image meta tag for a joomla 1.5 website with a logic on a part of the url.</p>
  
  <p>This is the code:</p>
  
  <pre><code>&lt;?php 
  $actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; 
  if (strpos($actual_link,'basket') !== false) { 
  ?&gt;
  
  &lt;meta property="og:image" content="http://astel-teglio.it/site/images/Basketball.png" /&gt;
  
  &lt;?php
  }else{
  ?&gt;
  
  &lt;meta property="og:image" content="http://astel-teglio.it/site/images/LOGO.jpg" /&gt;
  
  &lt;?php
  }
  ?&gt;
  </code></pre>
  
  <p>The logic is very simple, if the url contains basket I want to use the image Basketball.png, else LOGO.jpg.</p>
  
  <p>If I watch the source code in the browser I see the right attribute but when a paste the link on facebook I always see the Logo image (else case).</p>
  
  <p>There are the two sample pages:</p>
  
  <ul>
  <li><a href="http://astel-teglio.it/site/it/minibasket/stagione-20132014/scoiattoli/317--morbegno--molino-tudori-teglio-12-12.html" rel="nofollow">link with basket in the url (then case)</a></li>
  <li><a href="http://astel-teglio.it/site/it/manifestazioni/altre-manifestazioni/318-pronti-per-il-natale-2013.html" rel="nofollow">link  without basket in the url (else case)</a></li>
  </ul>