Book Image

Mastering Joomla! 1.5 Extension and Framework Development

By : James Kennard
Book Image

Mastering Joomla! 1.5 Extension and Framework Development

By: James Kennard

Overview of this book

<p><br />Joomla! is the world's hottest open-source content management system, and the winner of the 2006 Open Source CMS Prize. Out of the box, Joomla! does a great job of managing the content needed to make your website sing. But for many people, the true power of Joomla! lies in its application framework that makes it possible for thousands of developers around the world to create powerful add-ons and extensions. Many companies or organizations have requirements that go beyond what is available in the basic Joomla! package or in a freely available extension. Thankfully, Joomla! offers a powerful application framework that makes it easy for developers to create sophisticated add-ons that extend the power of Joomla! into virtually unlimited directions.<br /><br />If you use PHP programming to extend or customize Joomla!, this book is essential reading. If you feel that you've mastered the basics of creating Joomla! extensions, then this book will take you to the next level. Packed with expert advice on all aspects of development with Joomla!, you will learn about best-practice design and coding for Joomla! components, modules, plugins and other extensions. <br /><br />You will also learn about customizing the page output, using JavaScript effects, making use of Web Services from within Joomla! and ensuring that your code is secure and error-free.<br /><br />A unique and comprehensive reference to the main areas of interest within the Joomla! framework is also included in the book.</p> <p><a href="http://www.packtpub.com/article/joomla-one-point-five-extension-framework-table-of-contents"><br /></a></p>
Table of Contents (18 chapters)
Mastering Joomla! 1.5 Extension and Framework Development
Credits
About the Author
About the Reviewers
Preface
Appendix

Working with the Request


Generally when we develop PHP scripts, we work extensively with the request hashes: $_GET, $_POST, $_FILES, $_COOKIE, and $_REQUEST. In Joomla!, instead of directly using these, we use the static JRequest class. We use this because it allows us to process the input at the same time as retrieving it, this decreases the amount of code required and helps improve security.

The request hashes $_GET, $_POST, $_FILES, $_COOKIE, and $_REQUEST are still available, and in cases where we are porting existing applications we need not change the use of these hashes.

The two methods that we use the most are JRequest::setVar() and JRequest::getVar(). As the names suggest, one accesses request-data and the other sets it. In this example, we get the value of id; if id is not set, we return a default value, 0 (the default value is optional).

$id = JRequest::getVar('id', 0);

The JRequest::setVar() method is used to set values in the request hashes. In comparison to the JRequest::getVar...