Jump to content

Newbie: Calling PHP Variables Within OpenGraph Meta Data For Facebook


GarethW
Go to solution Solved by 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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.