MyBB Community Forums

Full Version: implementing FB Graps into global.php
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello

I am trying to "echo" the elements from json_decode.
My Current code is:

$fb_url = "http://graph.facebook.com/HardZoneFM";
$fb_json = file_get_contents($fb_url);
$fb = json_decode($fb_json);

i make external file, and it show what i want inside $fb->likes, but when i am going to put it into template, it doesnt show.
Any1 one know how to parse it correctly??

PS: tried $fb->likes, $fb['likes'], $fb->data['likes'], {$fb->likes}, {$fb['likes']}, {$fb->data['likes']}

dump?
dump Sad
if you use php in templates plugin then you can add the code directly to a template (eg. header template)

<?php
$fb_url = "http://graph.facebook.com/HardZoneFM";
$fb_json = file_get_contents($fb_url);
$fb = json_decode($fb_json); 
$fb_likes = $fb->likes;
echo $fb_likes;
?>