changing title of page doesn't work with facebook meta tags

Go To


I'm trying to set my meta tags for facebook like, but I have like button on changing page which means that title will be always different. My meta tag look like:

<meta property="og:title" content="<?php echo $listing['Listing']['title']?>" />

or whatever code I put there. It shows my title at debuger like:

<?php echo $listing['Listing']['title']?>

Simply sad, what's in inverted comas, that's title. Why? why it doesn't accpet that php code?

2012-04-03 19:41
by TomasJ
This does not sound like a facebook related question at all. Sounds like you are having problems with the output of the php script. Facebook just reads what you return and it's after the process of the php. At the bottom of the debug result you have "Scraped URL: See exactly what our scraper sees for your URL" click that and you'll see what your page returns - Nitzan Tomer 2012-04-03 19:56
I see but why it ignores that php script? and simply uses it as title - TomasJ 2012-04-03 19:59
I have no idea, you did not supply enough information regarding that aspect of things since you thought it's fb related. Can you please show more of the php script? Also, is that the only place in that script that is has php parts? If not, do other parts act the same or just this title thing - Nitzan Tomer 2012-04-03 20:01
I'm using joomla. My fb script looks like:

and I'm using ITP meta component to edit my meta tags and there I have put that php meta tag - TomasJ 2012-04-04 07:16

Don't put that amount of code into comments, edit your original question and add code there (using the code format). Now, as I already wrote the problem is not a facebook one, but a php one, and now after you mentioned it might very well has to do with joomla. Since I've never used joomla before I can't really help you with that, but I'll modify the tags of your question since the ones you have obviously won't help you find the answer - Nitzan Tomer 2012-04-04 07:33
Is the file you are putting the PHP code into a .php file? or a template file - Ben 2012-04-09 11:12


What file did you post the code into? It looks like it's not where it's supposed to be... I'd advise putting the tag into your template (/templates/yourtemplate/index.php)

Alternatively there's alot of extensions that can handle this for you:

2012-04-20 06:04
by Adam B