Advanced Joomla!.Pdf
Total Page:16
File Type:pdf, Size:1020Kb
www.it-ebooks.info For your convenience Apress has placed some of the front matter material after the index. Please use the Bookmarks and Contents at a Glance links to access them. www.it-ebooks.info Contents at a Glance About the Author �������������������������������������������������������������������������������������������������������������� xvii About the Technical Reviewer ������������������������������������������������������������������������������������������� xix Acknowledgments ������������������������������������������������������������������������������������������������������������� xxi Introduction ��������������������������������������������������������������������������������������������������������������������� xxiii ■ Chapter 1: Streamlining the Authoring Process ����������������������������������������������������������������1 ■ Chapter 2: Customizing Joomla with Widgets�����������������������������������������������������������������25 ■ Chapter 3: Constructing a Dynamic Template �����������������������������������������������������������������45 ■ Chapter 4: Using Template Overrides ������������������������������������������������������������������������������97 ■ Chapter 5: Using JavaScript and Ajax to Dynamically Load Page Elements �����������������111 ■ Chapter 6: Joomla and Web Services ����������������������������������������������������������������������������131 ■ Chapter 7: Joomla Security Administration ������������������������������������������������������������������159 ■ Chapter 8: Joomla Database Administration and Configuration �����������������������������������185 ■ Chapter 9: Testing a Site with ApacheBench, JMeter, and Selenium ����������������������������211 ■ Chapter 10: Using Development Tools ���������������������������������������������������������������������������249 ■ Chapter 11: Creating Joomla Menus, Articles, and Categories with PHP ����������������������273 ■ Chapter 12: Creating Core Extensions ���������������������������������������������������������������������������293 ■ Chapter 13: Connecting Joomla and Facebook �������������������������������������������������������������337 ■ Chapter 14: Development and Deployment �������������������������������������������������������������������355 Index ���������������������������������������������������������������������������������������������������������������������������������377 v www.it-ebooks.info Introduction If you’ve opened this book, I imagine you already appreciate how easy Joomla! makes it for you to run your web site or blog. Like me, you may be astonished that the excellent Joomla! developers have created such a solid, professional content management system and then made it free for all the world to use. Similar to its open-source cousin WordPress, Joomla! has grown from being used on a few hundred rudimentary web sites to literally having millions of advanced site deployments. Joomla! has evolved to become such a comprehensive system that you can literally do anything on a Joomla! site that is possible on an expensive, custom web site. And most of the time, there is a free extension available that augments the Joomla! core to do exactly what you want—with your only investment being the time it takes to install and configure. If you’ve read my other book, Beginning Joomla!, you have already seen the possibilities available to you if you go beyond the basic features of Joomla!. This book will take you up to the next levels. Whether you’ve created a small Joomla! site that you want to polish into a gem or you run a huge site that is straining to make that next growth step, this book will show you how to push Joomla! to its limits and beyond. I have written the book so you can add tremendous capabilities to your Joomla! site whether you have any development training or not. It will cover everything from advanced server deployment to using sophisticated extensions to creating world-class templates. If you have a development background, the information and source code presented here will provide you with an advanced understanding of how the Joomla! system operates from a foundation level all the way up to using some of its cooler bells and whistles. If you’ve never written a line of code, as long as you can use a text editor as simple as Notepad, you can take advantage of most of the technology presented in this book. I included all the source code in the text of the book because I find my learning experience frustrated if I have to leave the text to go look for some repository to examine the actual code. I like the code to be right where I can see it in context. That said, I wouldn’t want you to have to tediously enter the numerous lines of source to get the various projects working. All the source code is available on the Apress web site and I have also created a project on Github at https://github.com/drahmel/Advanced-Joomla. I would love for you to fork the code and make enhancements. Joomla! has flourished because of the number of people that have made significant contributions to the project from code to templates to tutorials. The real strength of Joomla! is the community. I hope you’ll be one of us! xxiii www.it-ebooks.info CHAPTER 1 Streamlining the Authoring Process If you have been using Joomla to create and manage a web site, you’ve probably been amazed by the power and flexibility that it gives you. You’ve created an attractive and robust web site in the time it would have taken you to manually create a simple page. Now you’re ready to turbo-charge your site with advanced configuration and custom extensions. You want to add new content quickly and skirt some of the potholes on the road to Joomla mastery. For this expertise, you’ve come to the right place. The new features available in the Joomla line have made it possible to run a professional, high-traffic web site without forcing you to learn to program. You get literally tens of thousands of man-hours of development—all for free download. Even better, Joomla was written by programmers who have a keen understanding of the best ways to allow developers to extend the existing system without compromising the fundamentals and the security of the core framework. So you can do as much or as little customization to your site as you want. This may be preaching to the choir, but here are some of the awesome Joomla features that we will build upon in this book: • Templating system that is both robust and easy to use: The template system is in some sense the core of Joomla in that the wide variety of fantastic templates (both free and commercial) have allowed any web master to simply install Joomla and add a template to make a completely professional and elegant site. The templating system has been augmented in many ways to allow a Joomla site to have all of the variety and flexibility of a custom developed site (more of this will be covered in Chapter 3). • Content management: Joomla has some superior ways of managing content, including the ability to move hundreds of articles at a time or set the URL for one specific article. You can share content editing responsibilities by setting up an authorization system. Joomla also includes the more basic capabilities such as rich text editing, metadata entry, pagination, and more (advanced content administration will be covered in Chapter 8). • Extension system that allows all manner of customization: Joomla has one of the most robust and well-developed extension systems allowing modules, components, and plug-ins to extend the functionality of the web site. You may already know how to create your own simple extensions, but in this book, I’ll take you to the next level where you can create almost any functionality that you might need to add to your site (and for the non-programmer, you'll learn how to use third-party widgets in the next chapter). • Complete GUI Administrator interface: The Administrator interface is attractive and powerful. With each new Joomla version comes many refinements and revisions, and the management user interface has become consistent among the various Managers (Extension Manager, Content Manager, and so forth). 1 www.it-ebooks.info CHAPTER 1 ■ STREAMLINING THE AUTHORING PROCESS • Search Engine Optimization (SEO) features: The developers of Joomla have spent a great deal of effort to “bake-in” job SEO features so a Joomla web master receives optimizations that companies usually have to pay an expert to detail for them. Most of the common problems that plague custom-built sites are never an issue for sites built on Joomla. Joomla makes sure every page has a title, that the URLs are search-engine friendly (if the option is switched on), includes 301 redirect support to manage page rank, and a slew of other features (you’ll learn how to configure these features in Chapter 7). Although Joomla is a fantastic product, there is rarely any formal training to configure and use Joomla. That means that some of the most powerful features go unused or are used improperly. For many Joomla content creators, sometimes creating and adjusting the presentation of that content can be a challenging process. In this chapter, I’ll help you resolve some of these common problems and make the life of a Joomla site administrator much easier and more satisfying. More productivity with the system will increase both the quality and quantity of the site content because time won’t be consumed dealing with these obstacles. Once you gain a fundamental understanding of the basic technology underlying the Joomla system—knowledge