Help: Style data after getting it from Facebook Graph API

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Help: Style data after getting it from Facebook Graph API

    Hello all,

    as said on Facebook Developers page, pointing your browser at http://graph.facebook.com/ervis.mysterio/feed will get my Facebook feeds.

    Anyone has a script or a clear logic how to style this data? I am trying many ways with PHP expressions but no result till now... And time passes fast...

    (p.s.: No suggestion to use secret key please, because I need this way)
    mysterio.al - programming is a functional art

    #2
    i assume u already knw hw to get the stream so heres what u can do:
    PHP Code:

    <table>
    <?php
    $data 
    $facebook->api('/me?limit=10');
    foreach(
    $data as $k => $v){
     
    $pic '<img src="'.arrGet($v'picture''no_photo.jpg').'"/>';
     
    $full_name arrGet($v['from'], 'name''No name');
     
    $msg arrGet($v'message');
     
    $link arrGet($v'link'FALSE);
     
    $link $link '<a href="'.$link.'">'.arrGet($v'name'$link).'</a>' null;
     
    $desc arrGet($v'description'null);
     
    $caption arrGet($v'caption'null);
     
    $likes arrGet($v'likes'FALSE);
     
    $likes $likes arrGet($v['likes'], 'count') : 'No';
     
    $cmts arrGet($v'comments'FALSE);
     
    $cmts $cmts arrGet($v['comments'], 'count') : 'No';
    ?>
    <tr>
    <td><?=$pic ?></td>
    <td colspan="2">
    <?=$full_name ?> <?=$msg ?><br />
    <?=$link ?><br />
    <?php echo $caption $caption.'<br/>' null ?>
    <?=$desc ?>
    <br/>
    <div align="right">
    <?=$likes.' Likes' ?> | <?=$cmts.' Comments' ?>
    </div>
    </td>
    </tr>
    <?php
    }
    ?>
    </table>
    Last edited by CreativityKills; 11.05.11, 14:44.

    Comment


      #3
      Then add the arrGet function:
      PHP Code:
      function arrGet(array $array$key$default null){
      return (isset(
      $array[$key]) AND ! empty($array[$key])) ? $array[$key] : $default;

      Comment


        #4
        Originally posted by CreativityKills View Post
        i assume u already knw hw to get the stream so heres what u can do:
        I really don't know how you mean. Intsead of learning something, I only get more confused.

        Can it be fetched using Graph API. I can't understand the "access token" yet...
        mysterio.al - programming is a functional art

        Comment


          #5
          Download the facebook php sdk from github, it takes care of everything on the inside, all you have to do is make calls and it adds the tokens simple.
          Last edited by CreativityKills; 19.05.11, 09:06.

          Comment


            #6
            If u use fb sdk u may have to enter ur secret key :p
            PHP Code:
            /* I don't know everything hehe */ 
            Find me on facebook

            Comment


              #7
              Originally posted by Ponick View Post
              If u use fb sdk u may have to enter ur secret key :p
              if i needed to tell him that it would have implied i thought he was a dumbass

              Comment


                #8
                Originally posted by CreativityKills View Post
                if i needed to tell him that it would have implied i thought he was a dumbass
                lol, thank you! :p
                mysterio.al - programming is a functional art

                Comment

                Working...
                X