rboyart Posted June 3, 2013 Share Posted June 3, 2013 Je cherche ajouter le nombre de fans dans ma page facebook dans mon template prestashop. Créer une variable Smarty qui se met à jour. J'ai trouvé du php pour le faire : <?php require_once('facebook.php'); $facebook = new Facebook(array( 'appId' => 'your_app_id', 'secret' => 'your_app_secret', 'cookie' => true, )); $result = $facebook->api(array( 'method' => 'fql.query', 'query' => 'select fan_count from page where page_id = your_page_id;' )); $fb_fans = $result[0]['fan_count']; ?> ou simple : <?php $page_id = "XXXXXXXXXXXX"; $xml = @simplexml_load_file("http://api.facebook.com/restserver.php?method=facebook.fql.query&query=SELECT%20fan_count%20FROM%20page%20WHERE%20page_id=".$page_id."") or die ("a lot"); $fans = $xml->page->fan_count; echo $fans; ?> Pourrais quelqu'un m'aider ou m'indiquer comment il faut faire avec smarty? Comment on rajoute du php dans dans un smarty template .tpl sans faire n'importe quoi? Merci, Rodrigo Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now