Jump to content

Newbie: Calling PHP Variables Within OpenGraph Meta Data For Facebook


GarethW

Recommended Posts


Hi,

I'm trying to pass a variable from my php script on the page into the og;metadata, but on the timeline all that is shown is the standard html metadata, am I using the correct php code to call the variable so that it shows up on the timeline?

        <meta property="og:title" content="<?php $_GET['$title']; ?>"/>

the title variable comes from here;

        $title = urlencode("Take The Test!");

Any help on this is much appreciated, Gareth

Thanks @ginerjm, and @Mancent,

 

I realised that the Opengraph method is not the way to go (cacheing issues), I was wondering if you could help on this hopefully simple question, is it possible (or have I got the wrong syntax) to pass e.g. '$title' etc  into an array:

 

$params = array(
   "caption" => "$title",
  "description" => "$text"
);

 

From

 

$title = urlencode("My Sample Title Title");

$text = urlencode("My Sample Description Text");

 

Again, any help is much appreciated, Gareth

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.