Facebook feed example

Here's a very short (and simple) example how to include news feed from your Facebook profile to your WhizBase-powered web page:

$WBSETV[FBL|$WBGETRSS[http://www.facebook.com/feeds/page.php?id=187818704590124&format=rss20|FBFeed|20|T]]
$WBFOR[loopcounter|0|$WBGETV[FBL]|1|
<a href="$WBGETV[FBFeed_Link($WBGETV[loopcounter])]" target="_blank">$WBIF["$WBTRIM[$WBGETV[FBFeed_Title($WBGETV[loopcounter])]]"<>""|$WBGETV[FBFeed_Title($WBGETV[loopcounter])]|WhizBase shared a link.]</a><br>
]

Now let's analyze the code.

1. $WBSETV[FBL|$WBGETRSS[http://www.facebook.com/feeds/page.php?id=187818704590124&format=rss20|FBFeed|20|T]]

In this line we use WhizBase function WBGETRSS to download an RSS feed from Facebook to WhizBase RSS arrays (Title, Link, Description and Pubdate) with prefix FBFeed (limited to last 20 posts) and to save the number of returned feeds to variable FBL. Note that you need to replace our Facebook profile ID (187818704590124) with your own (to get your profile ID simply right-click your Facebook profile image, select Properties or Image info and check the middle number in the image name - e.g. here's our profile image name:592083_187818704590124_958022734_n.jpg ).

2. $WBFOR[loopcounter|0|$WBGETV[FBL]|1|

This line starts the For loop (using WhizBase function WBFOR) increasing the value of variable loopcounter from zero (0) to value of variable FBL.

3. <a href="$WBGETV[FBFeed_Link($WBGETV[loopcounter])]"
target="_blank">$WBIF["$WBTRIM[$WBGETV[FBFeed_Title($WBGETV[loopcounter])]]"
<>""|$WBGETV[FBFeed_Title($WBGETV[loopcounter])]|WhizBase shared a link.]</a><br/>

This line generates a link using WhizBase RSS arrays FBFeed_Link and FBFeed_Title, checking if FBFeed_Title member is empty and replacing the empty value with text "WhizBase shared a link" (of course, you'll use your own text).

4. ]

This line simply closes WhizBase function WBFOR opened in line 2.

As you can see we use WhizBase to build simple HTML code that can be formatted in any way you want by simply adding style element to html code in line 3 between <a and href.

Click here to open the example in new window


Whizbase lite