Quantcast
Viewing latest article 6
Browse Latest Browse All 10

PHP activity feed - similar to Facebook - How to convert response from json to HTML elements

We are building a activity stream kind of website very similar to facebook (in activity feed alone). For loading user's activity feed, we send the request to PHP file through AJAX method. Server file will handle the logic and return back the values as an array in JSON format. I wanted to know, is there any framework available to write the JSON response to HTML elements. Also, the fees are not similar. It will vary according to the type (Photo, Album, Status Updated, Shared, Liked, etc). So i need to load different template view for each of the activity feed. Actions will be common like Share, Comments for all feeds.

Can you please share which will be the best approach to load the content according to the data received. Also the content need to be refreshed periodically. I have pasted the sample JSON response below for reference:

{
  "id": "1",   
  "picture": "", 
  "link": "http://www.google.com", 
  "name": "Srini updated status", 
  "description": "Lorem ipsum",   
  "actions": [
    {
      "name": "Share", 
      "link": "http://networkedblogs.com/hGWk3?a=share"
    }
  ], 
  "type": "statusupdate",   
  "created_time": "2011-05-10T18:35:38+0000", 
  "updated_time": "2012-07-20T10:42:58+0000", 
  "likes": {    
    "count": 0
  }, 
  "comments": {
    "data": [
      {
        "id": "19292868552_10150189643478553_22286888", 
        "from": {
          "name": "Lorenzo Portillo", 
          "id": "613727863"
        }, 
        "message": "does anyone knows why i get a rhombus and '?' in my app     description when I publish in a user's wall, instead of a letter with accent?!?!?!?!?!?", 
        "created_time": "2012-05-28T13:48:45+0000"
      }, 
    "count": 1
  }
}

Need help / suggestions on how to design the template according to the json array in javascript. Any comments / code help will be more helpful.

Thanks in Advance,

Regards

Srinivasan.C


Viewing latest article 6
Browse Latest Browse All 10

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>