php - Facebook Events Display Order -
i made page can see event public page
the php code
<?php require 'src/facebook.php'; $facebook = new facebook(array( 'appid' => 'id', 'secret' => 'secret', 'cookie' => true, )); try{ $events=$facebook->api('/page/events?access_token=token'); }catch (facebookapiexception $e){ error_log($e); } foreach ($events["data"] $event){ // time $starttime=strtotime($event["start_time"]); // upcoming events if ((time()-$starttime)<=60*60*24*1 || $starttime>time()){ echo '<li><a href="#" id="'.$event["id"].'" class="event_link"> <img class="ui-li-thumb" src="https://graph.facebook.com/'.$event["id"].'/picture?type=small" width="70px;" height="100%" /> <h3 class="ui-li-heading">'.$event['name'].'</h3> </a></li>'; } } ?>
it working fine closest event last 1 in list
how can change order of output??(if possible ofcourse).
you'll have use fql
that. fql - event
so in query use, order by
, sort in order wrt parameter
for eg:
select eid event creator=page_id , eid in (select eid event_member uid=page_id) order start_time desc
Comments
Post a Comment