Contents at a Glance
Total Page:16
File Type:pdf, Size:1020Kb
02_277959-ftoc.qxp 5/5/08 11:24 AM Page vii Contents at a Glance Introduction .................................................................1 Part I: Getting Friendly with the Facebook Platform........7 Chapter 1: Introducing Facebook and the Facebook Platform.....................................9 Chapter 2: The App Walkabout: Building Your First Facebook Application.............29 Part II: Poking the API ...............................................47 Chapter 3: Working with the Facebook API...................................................................49 Chapter 4: Writing Facebook Markup Language (FBML) ............................................95 Chapter 5: Exploring FQL: Facebook Query Language..............................................121 Chapter 6: Scripting with Facebook JavaScript..........................................................143 Chapter 7: “Goin’ API” with Facebook Developer Tools............................................167 Part III: Developing Facebook Applications ................177 Chapter 8: Developing Facebook Canvas Pages.........................................................179 Chapter 9: Creating Content for Profile Pages............................................................195 Chapter 10: Seamless Styles: Styling Your Facebook Application............................215 Chapter 11: Hear Ye, Hear Ye: Communicating with the News Feed and Notifications ...............................................................................235 Chapter 12: Tying It All Together: Speed Dial Application........................................249 Part IV: The Part of Tens ...........................................299 Chapter 13: Ten Strategies to Exploit the Power of the Facebook Platform...........301 Chapter 14: Ten Killer Facebook Applications to Explore ........................................313 Chapter 15: Smashing Successes: Ten Tips for Making Your Application Popular............................................................................................321 Index .......................................................................327COPYRIGHTED MATERIAL 02_277959-ftoc.qxp 5/5/08 11:24 AM Page viii 02_277959-ftoc.qxp 5/5/08 11:24 AM Page ix Table of Contents Introduction..................................................................1 About This Book...............................................................................................1 Foolish Assumptions .......................................................................................2 Conventions Used in This Book .....................................................................2 What You Don’t Have to Read ........................................................................3 How This Book Is Organized...........................................................................3 Part I: Getting Friendly with the Facebook Platform .........................3 Part II: Poking the API ............................................................................3 Part III: Developing Facebook Applications ........................................4 Part IV: The Part of Tens........................................................................4 Icons Used in This Book..................................................................................4 Where to Go from Here....................................................................................5 Sample Files for This Book..............................................................................5 Part I: Getting Friendly with the Facebook Platform ........7 Chapter 1: Introducing Facebook and the Facebook Platform . .9 Discovering Facebook ...................................................................................10 News Feed .............................................................................................10 Profile.....................................................................................................12 Discovering the Pulse of Facebook: The Social Graph..............................15 What Is the Facebook Platform?...................................................................16 Points of integration ............................................................................16 Facebook application architecture ....................................................22 Exploring the Framework Components.......................................................24 Facebook API ........................................................................................24 Facebook Markup Language ...............................................................25 Facebook Query Language..................................................................25 Facebook JavaScript ............................................................................26 Chapter 2: The App Walkabout: Building Your First Facebook Application . .29 Registering an Application with Facebook .................................................30 Creating a Simple Facebook Application ....................................................37 Adding an Icon to the Application ...............................................................41 Setting the Initial Content of the Application’s Profile Box ......................42 Adding an About Page ...................................................................................43 02_277959-ftoc.qxp 5/5/08 11:24 AM Page x x Building Facebook Applications For Dummies Part II: Poking the API ................................................47 Chapter 3: Working with the Facebook API . .49 Calling the Facebook API...............................................................................49 Evaluating What Comes Back from Facebook ............................................55 Getting Friendly with Friends .......................................................................56 Getting friends with friends.get..........................................................57 Evaluating friends with friends.areFriends .......................................58 Getting friends who are app users with friends.appUsers..............60 Accessing Events............................................................................................62 Getting the events of a user ................................................................62 Getting the members of an event .......................................................69 Getting Cozy with Groups .............................................................................72 Getting groups with groups.get ..........................................................73 Retrieving member info with groups.getMembers ..........................80 Facebook Pages..............................................................................................83 Getting page information with pages.getInfo....................................84 Scoping out with pages.isAppAdded .................................................86 Getting current user info with pages.isAdmin and pages.isFan .....87 Pulling User Data............................................................................................87 Getting the current user with users.getLoggedInUser ....................87 Getting info with users.getInfo ...........................................................88 Checking whether a user has your app with users.isAppAdded ...93 Checking permissions with users.hasAppPermissions...................93 Chapter 4: Writing Facebook Markup Language (FBML) . .95 Exploring FBML ..............................................................................................95 Working with Users and Groups.................................................................103 Displaying Content Conditionally ..............................................................106 Testing on canvas pages....................................................................107 Showing and hiding content in profile boxes .................................109 Using fb:if and fb:switch ....................................................................111 Adding Facebook UI Elements and Widgets .............................................112 Discussing it on the board ................................................................113 Another comment on the Wall..........................................................114 Building a Wall post by post .............................................................115 Creating Requests and Invitations.............................................................116 Building a standard-sized request form ..........................................116 Building a condensed request form.................................................120 Chapter 5: Exploring FQL: Facebook Query Language . .121 Discovering Why SQL + Facebook API = FQL............................................121 Comparing FQL and API access........................................................122 Making an FQL statement..................................................................123 Differences between SQL and FQL ...................................................123 02_277959-ftoc.qxp 5/5/08 11:24 AM Page xi Table of Contents xi Writing a Basic Query..................................................................................124 Changing the field order in the result set........................................127 Dealing with array-type fields...........................................................128 Using operators in the WHERE clause.............................................128