Solved

Facebook FBML markup not working with PHP

Posted on 2008-10-13
3
2,832 Views
Last Modified: 2013-12-13
I have a problem with getting the fbml markup to work in the footprints example from Facebook. Yes this is my first Facebook app tryout :).

My setup is :
IIS 6.0 W2003
PHP 5.2.6
MySQL 5.0
Files : Footprints example downloaded from http://svn.facebook.com/svnroot/platform/clients/packages/facebook-platform.tar.gz

The Application works fine in almost all ways except for the <fb:name firstnameonly="true" uid="<?=$user?>" useyou="false"/> command not showing my name, hence fbml not working.

Howeve if I add these variables in line 15  
   $user_info = $facebook->api_client->users_getInfo($user, 'first_name');
   $firstname = $user_info[0]['first_name'];
and switch
  <?php echo $firstname?> with <fb:name firstnameonly="true" uid="<?=$user?>" useyou="false"/> in line 31 everything works fine.

$facebook->get_add_url() does not work either.

Is that the only solution to this with my setup or am I forgetting some library in the php setup?
Hints are very much appreciated.

Also just wondering if there should be a reference to fbml in php.ini
<?php
 
// the facebook client library
include_once '../php/facebook.php';
 
// some basic library functions
include_once 'lib.php';
 
// this defines some of your basic setup
include_once 'config.php';
 
$facebook = new Facebook($api_key, $secret);
$facebook->require_frame();
$user = $facebook->require_login();
 
if (isset($_POST['to'])) {
  $prints_id = (int)$_POST['to'];
  $prints = do_step($user, $prints_id);
} else {
  if (isset($_GET['to'])) {
    $prints_id = (int)$_GET['to'];
  } else {
    $prints_id = $user;
  }
  $prints = get_prints($prints_id);
}
 
?>
<div style="padding: 10px;">
 
  <h2>Hi <fb:name firstnameonly="true" uid="<?=$user?>" useyou="false"/>  !</h2><br/>
  <a href="<?= $facebook->get_add_url() ?>">Put Footprints in your profile</a>, if you haven't already!
    <form method="post" >
<?php
      if ($prints_id != $user) {
        echo 'Do you want to step on <fb:name uid="' . $prints_id . '"/>?';
        echo '<input type="hidden" name="to" value="' . $prints_id . '"/>';
      } else {
        echo '<br/>Step on a friend:';
        echo '<fb:friend-selector idname="to"/>';
      }
?>
      <input value="step" type="submit"/>
    </form>
  <hr/>
  These are <fb:name uid="<?= $prints_id ?>" possessive="true"/> Footprints:<br/>
  <?php echo render_prints($prints, 10); ?>
  <div style="clear: both;"/>
</div>

Open in new window

0
Comment
Question by:Njordur
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 40

Accepted Solution

by:
Richard Quadling earned 500 total points
ID: 22723378
2 things.

1 - What is the HTML output for this?

2 - Change ...

<?=$user?>

to

<?php echo $user; ?>

0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 22723381
For thing 1, do a view source on the page that is displayed and extract the bit relating to this question.
0
 

Author Closing Comment

by:Njordur
ID: 31505752
Thanks for the input, I came to the same conclusion... there was a variable in php.ini that I forgot to set on
0

Featured Post

Free NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
This article discusses how to implement server side field validation and display customized error messages to the client.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question