Facebook Application Programming Step by step tutorial - part 11. What is the conditional? A simple example as follows:
If you have money, you can buy car.
In PHP, you can use like this:
If($money){
echo "you can buy car";
}else{
echo "Oh, no! So sad…";
}
On Facebook, you will also find conditional situation. Example, you will display a page if the user meets certain requirements. That's why Facebook to provide facilities to display content conditionally. There are friends who can see everything in your application. But there is also a friend who can only see things limited. While the public can you give a facility to view specific points.
To use the conditional, you can use elements fb:if. Example, there are parts that are not allowed visits by a particular user, you can combine its use with fb:visible.
The following elements are available in the Facebook canvas page, but not in the profile box:
- fb:if-can-see
- fb:if-can-see-photo
- fb:if-is-app-user
- fb:if-is-friends-with-viewer
- fb:if-is-group-member
- fb:if-is-user
- fb:if-user-has-added-app
- fb:is-in-network
If is true, then the content will be displayed inside. Each element of the above also supports fb:else that serves to display the content in it if false.
Next: Facebook Programming: FBML - fb:if-can-see