|
How To Do Everything: Facebook Applications
The first book to show how to create apps for the hottest social networking siteThis hands-on guide teaches you how to build applications that run on the most popular social networking site among college students, professionals and business users. Written in the popular, easy-tofollow How to Do Everything format, this book is designed to enable even
those with minimal technical skills to create Facebook Platform applications.With coverage of all the technologies involved, including Facebook Platform API, FBML, FQL, MySQL, and REST, How to Do Everything: Facebook Applications provides a single source of structured guidance that is far easier to understand than the disparate tutorials available on the Web. You will learn how integrate Facebook applications with websites and databases, and use your applications to sell a product or market a business, non-profit organization, or political cause. A pre-built, customizable Facebook application will be available for download.
CONTENTS:
Table of Contents
Acknowledgments xv
Introduction xvii
Facebook Applications: What They Are and How to Use Them
Use Facebook as a Social Utility 3
Understand the Facebook World 5
Social Utility 5
Virality 5
Social Graph 6
Web 2.0 6
The Size of the Facebook World 6
Use Facebook Basics 7
Profile and Preferences 7
Facebook Applications 10
Networks 10
The Wall 11
Find Your Way Around Your Facebook Home Page and Profile 13
Use Basic Navigation 15
The Facebook Frame 15
The Left-Hand Column (Left Nav) 17
The Footer Links 17
The Canvas 18
Manage Your Account 19
Account Settings 19
Use Your Home Page 21
Home Page Contents 21
Controlling Your Home Page 22
Platform Elements for the News Feed 28
Use Your Profile 29
Profile Page Layout 29
Profile Information 33
Visibility for Pokes, Messages, and FriendRequests 37
Friends and Search 39
Interact with Facebook Pages 42
Find Your Way Around Facebook 45
Use the Mini-Feed 47
Platform Elements for the Mini-Feed 47
Use the Wall 47
Platform Elements for the Wall 49
Use the Inbox and Messages 49
Work with Pokes 49
Platform Elements for Pokes 49
Handle Requests and Notifications 50
Platform Elements for Requests and Notifications 50
Use Friend Finder and Invite Friends 51
Use Social Ads 52
Get Started 53
Create a Facebook Page 53
Choose the Audience 55
Create the Ad 57
Set the Budget 58
Review the Ad and Pay 60
Develop Polls 61
Handle Subscriptions 63
Find Your Way Around a Facebook Application: Groups 65
Create and Manage Groups 67
Create and Edit Groups 68
Group Info 69
Picture 72
Use Groups 73
View Discussion Board 74
Message All Members 74
Edit Group, Members, and Officers; Invitations 75
Create Related Events 75
Use Facebook Identifiers 82
Use the Groups Application 82
Groups API 82
Launch Groups 84
My Groups 85
Browse Groups 86
Popular 87
Look at the Facebook Elements in Groups Pages 87
Use Other Facebook Applications 91
Add and Edit Applications and Their Privacy Settings 92
Add an Application 93
Control Application Privacy Settings 95
Photos 99
Photo Albums 100
Photos 102
Tags 102
Events 104
Integrate Facebook Using Notes and Mobile 107
Import a Blog 108
Use a Mobile Phone 109
Use Facebook Technologies
Use XML, XHTML, and CSS 115
Use XML for Data Transfer 117
Understand the Basics of XML 118
Understand XML Syntax 119
Use XML Elements 120
Use XML Namespaces 121
Use XHTML on Your Facebook Pages 122
Using div Elements 122
The id Attribute and Facebook 124
Validate Your Facebook Web Page Syntax 124
Debug Facebook XHTML 124
Use CSS to Format Your Facebook Pages 125
Facebook and Style Sheets 126
Learn the Facebook Style Basics 126
Use PHP 129
Understand PHP Basic Syntax 132
Use PHP Delimiters 132
Use Comments 132
Use Terminators 133
Use PHP Variables and Arrays 133
Use PHP Strings 133
Building Concatenated Strings 134
Use PHP Conditional Statements 135
Use Multiple PHP Files 137
Use PHP Functions 137
Handle Exceptions 139
Understand Overall Facebook Architecture 143
Work with the Architecture 144
How the Canvas Works 145
How the Profile Page Works 147
Use the Facebook Object 147
Use the Facebook REST Object 149
Parameters Are Provided for You 151
Output Is Parsed for You 151
How the Facebook REST Object Works Internally 152
Use Facebook Markup Language (FBML) 155
Use the FBML Test Tool 158
Use FBML Data Elements 159
Use FBML Control Elements 160
Use the FBML Share Element 161
Sharing a URL 163
Sharing Data 163
Use FBML Forms 164
Use FBML Dialogs 166
Use the Facebook API 169
Use the User API 171
users_getInfo 171
users_getLoggedInUser 172
users_isAppAdded 173
Use the Profile API 173
set_FBML 173
get_FBML 173
fbml_refreshImgSrc 173
fbml_refreshRefURL 173
fbml_setRefHandle 174
Use Events API 174
events_get 174
events_getMembers 175
Use the Feed API 175
feed_publishStoryToUser 175
feed_publishActionOfUser 176
feed_publishTemplatizedAction 176
Use the Friends API 177
friends_areFriends 177
friends_get 177
friends_getAppUsers 177
Use the Groups API 177
groups_get 177
groups_getMembers 178
Use the Notifications API 178
notifications_get 178
notifications_send 178
notifications_sendEmail 179
Use the Photos API 180
photos_get 180
photos_getAlbums 180
photos_getTags 181
Use the Marketplace API 181
marketplace_createListing 181
marketplace_removeListing 182
marketplace_getCategories 182
marketplace_getSubCategories 182
marketplace_getListings 182
marketplace_search 182
Use Facebook Query Language (FQL), Mock-AJAX, FBJS, and Facebook Mobile 183
Use Facebook Query Language (FQL) 184
Use Dynamic FBML Action Attributes 186
Use Mock-AJAX 186
Use FBJS 187
Use Facebook Mobile 189
Watch for Further Developments 190
Build Facebook Applications
Get Started as a Facebook Developer 195
Add the Facebook Developer Application 196
Create a New Application 199
Set Up the New Application 200
Create the Application on Your Server 200
Connect the Application to Facebook 203
Test 206
Update the About Page 209
Add the Application 209
Create a Test Account 212
Build a Basic Interface 215
Decide What You Want to Do 216
Design the Application 218
Add Value to Facebook 218
Become Facebook-ish 219
Draw the Facebook Line 220
Obey the Rules 221
Iterate 222
Start to Build the Sample Application 222
Decide What You Want to Do 222
Decide How You Want to Do It 223
Design the Application 223
Set Up the Application Parameters 227
Implement the Basic Page and Navigation 228
Choose the Basic Design 228
Implement the Basic Design 231
Implement the Pages 234
Home Page 237
My Events 241
Friends' Events 242
Browse Events 242
Implement Utilities 243
Event Retrieval 243
Event Display 245
Begin to Test 251
Integrate MySQL Data 253
Understand SQL Basics 255
Use MySQL 257
Explore the Example Database 258
Work with the Schema 258
Build the Database (if necessary) 262
Use MySQL Query Browser for Testing 265
Construct and Test the First Query (Adding/Removing Favorites) 269
Connect to the Database 270
Send Parameters to the Script 271
Add to the Table 272
Remove Items from the Table 275
Putting It Together 275
Finish the PHP Work: Overview 277
function get_from_database_and_render ({dollar}nColumns, {dollar}owner, {dollar}user) 277
function render_cae ({dollar}nColumns, {dollar}owner, {dollar}user, {dollar}results) 277
function render_cae_columns 278
Finish the PHP Work: Details 278
function get_from_database_and_render ({dollar}nColumns, {dollar}owner, {dollar}user) 278
function render_cae ({dollar}nColumns, {dollar}owner, {dollar}user, {dollar}results) 283
function render_cae_columns 285
Add More Features 287
Use Public Canvas Pages and Control Adding Applications 288
Greet the User by Name 290
Update the Profile Page 290
Update the Profile Box 291
Get the User's Text 292
Add News Feed and Mini-Feed Items 294
Actor and Target 295
Title 295
Body 296
Images 297
Targets 297
Implement a Template Story 298
Paginate Results 302
Design the Pagination Architecture 304
Use the Facebook Pagination Styles 305
Change get_from_database_and_render Parameters 306
Change the Page That Calls get_from_database_and_render 307
Implement Pagination in get_from_database_and_render 308
Implement Let Friends Know 313
Implement the Share Button 314
Add More SELECT Options 315
Add a Discussion Board 317
Improve Security 318
Get Started with Facebook Applications 319
Index 321
|