Book Image

PHP 5 Social Networking

By :
Book Image

PHP 5 Social Networking

By:

Overview of this book

<p>Social Networking has quickly become a very popular activity on the Internet, particularly with the emergence of sites like Facebook and MySpace. PHP is a flexible web development language used on a wide variety of sites, including Facebook and Yahoo! But building a social networking site from scratch using PHP involves some complex logic, and also some serious coding.</p> <p>This book will demonstrate how to create, maintain, and extend a powerful social network site. It shows how to create your own flexible social networking framework, allowing users to sign up, customize their profile, befriend other users, share information, communicate, interact with one another, and much more.</p> <p>Taking best practices, such as object-oriented programming, and the Model-View-Controller architecture, this book will begin by walking through the development of a simple development framework, which is then used to rapidly build a Social Networking platform, building upon the social features chapter by chapter. At the end of this book, you will have a powerful Social Networking platform loaded with many features which can take the user from signing up and connecting with other users to posting and sharing information. With an API in place, the platform can be extended and used by other Social Networks. This book doesn’t just stop with the code and the logic behind it; useful supplementary information is also covered, such as marketing the Social Network, keeping Search Engine Optimization in mind when developing, backing up and maintaining the site, and how to deal with large amounts of traffic through scaling.</p> <p>By the end of this book, you will be left fully prepared to build, manage, maintain, and extend a powerful Social Network for your business, hobby, organization, family, and clients.</p>
Table of Contents (21 chapters)
PHP 5 Social Networking
Credits
About the Author
Acknowledgement
About the Reviewers
Preface
Index

Changes to the view


Since all of the media types we are going to support require at least one additional database field in a table that extends the statuses table, we are going to need to display any additional fields on the post status form. The standard type of status doesn't require additional fields, and new media types that we haven't discussed, which we may wish to support in the future, may require more than one additional field. To support a varying number of additional fields depending on the type, we could use some JavaScript (in this case, we will use the jQuery framework) to change the form depending on the context of the status. Beneath the main status box, we can add radio buttons for each of the status types, and depending on the one the user selects, the JavaScript can show or hide the additional fields, making the form more relevant.

Template

Our update status template needs a few changes:

  • We need to set the enctype on the form, so that we can upload files (for posting images...