Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Elgg 1.8 Social Networking

You're reading from   Elgg 1.8 Social Networking Create, customize, and deploy your very own social networking site with Elgg with this book and ebook

Arrow left icon
Product type Paperback
Published in Feb 2012
Publisher Packt
ISBN-13 9781849511308
Length 384 pages
Edition 1st Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Cash Costello Cash Costello
Author Profile Icon Cash Costello
Cash Costello
Arrow right icon
View More author details
Toc

Table of Contents (21) Chapters Close

Elgg 1.8 Social Networking
Credits
Foreword
About the Author
About the Author of 1st edition
About the Reviewers
www.PacktPub.com
Preface
1. Social Networking and Elgg FREE CHAPTER 2. Installing Elgg 3. A Tour of Your First Elgg Site 4. Sharing Content 5. Communities, Collaboration, and Conversation 6. Finding and Using Plugins 7. Creating Your First Plugin 8. Customization through Plugins 9. Theming Elgg 10. Moving to Production Developer's Quick Start Guide Views Catalog Index

Page handlers


Page handlers manage the response to a request. The response can be a web page, RSS feed, or any number of other output formats. Because Elgg uses the MVC pattern, the same handler is used for different response formats; only the views change.

A page handler is registered by mapping a URL identifier to a function, as follows:

elgg_register_page_handler('blog', 'blog_page_handler');

This handler function is called when a request is made to a URL starting with /blog/.

The handler function receives an array of the segments of the URL. This array is used to further route the request in the handler. The handler function can process requests in the function itself, include page handling scripts, or use a page handler class. Developers can select the approach that best matches the job and their programming style.

Page handlers include both controller and view code and work like the following:

  1. Access any user input through get_input().

  2. Pull data from the model related to the request.

  3. Push the data into the views system for rendering.

  4. Send output to the requester using elgg_view_page().

Code location

Core page handlers: directories in /pages/

Example of script-based page handling in a plugin: bookmarks plugin

Example of function-based page handling in a plugin: blog plugin

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image