Facebook Meta Tag og:image PHP condition

I used that PHP code for og:image meta tag but it doesn't work, it's right but it doesn't call the right source of the image.

<?php JFactory::getDocument(); $document->addCustomTag('<meta property="og:image" content="http://www.sell4masari.com/images/com_adsmanager/ads/<?php.$img->image?>" />');?>

So I will appreciate any help from anyone.

Answers


You're putting the <?php tags inside the quotes, so it is not being processed:

content="[...]/ads/<?php.$img->image?>" />');

You need to build the string through concatenation, like so:

<?php JFactory::getDocument(); $document->addCustomTag('<meta property="og:image" content="http://www.sell4masari.com/images/com_adsmanager/ads/' . $img->image . '" />');?>

Need Your Help

How to create a self signed certificate containing a CRL Distribution point

c# wcf security ssl

I have created a Self Signed Certificate using makecert.exe by reading the following msdn link:

Why are DateTime.Now DateTime.UtcNow so slow/expensive

c# performance micro-optimization

I realize this is way too far into the micro-optimization area, but I am curious to understand why Calls to DateTime.Now and DateTime.UtcNow are so "expensive". I have a sample program that runs a ...