Abhishek
Abhishek

Reputation: 65

Whats the mistake here?

It is probably a silly mistake but i'm into splits because of it :(

Language : PHP 5.4.7 \n Framework: CodeIgniter 2.1.3 , SDK: Facebook PHP SDK 3.2.2

Please consider the following Controller function:-

public function index()
{
  //  $this->__construct();
    $data['profile'] = $this->_facebook->api('/me?fields=id');
    $this->load->view('user_profile',$data);
}

And the corresponding view (user_profile.php) :-

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Showing the user profile</title>
</head>
<body>

<?php
//echo print_r($user_profile,TRUE);
echo '<IMG SRC="http://graph.facebook.com/'. $profile['id'] . '/picture" HEIGHT=32 WIDTH=32 /> ';
?>
</body>
</html>

The above code shows the profile picture in Internet Explorer but in Chrome the page is blank. On viewing page source, it is blank.

Upvotes: 0

Views: 80

Answers (1)

Halfstop
Halfstop

Reputation: 1772

I would start with writing cleaner html.

<img src="http://graph.facebook.com/<?php echo $profile['id']; ?>/picture" alt="Profile Photo" height="32" width="32" />

Don't capitalize tags and img requires an alt attribute. I always quote attribute values, even when they're numbers.

Upvotes: 1

Related Questions