34,79 €
Setting up a basic Joomla! Web site is easy; what comes next is hard and expensive ñ making the site do exactly what and look exactly how you want. With this book in hand, it is easy to adapt your site to bring your vision fully to life.
This book will help you to separate your site from the crowd of other Joomla! sites without having to invest in developers. It will guide you through how to customize different parts and aspects of your site and will also show you how to turn your site into a profitable business via these customizations. You will be able to build a successful, professional web site that will adapt to all your business needs.
You will be taken beyond the basics of Joomla!, and given an insight into the techniques and tools used by the professionals to rapidly develop unique, custom sites. This will enable you to develop your own professional-quality Joomla! site without assistance, saving you time and money. You will learn how modules, plugins, components, and templates are constructed, and how to make changes in them, giving you the confidence to make more elaborate changes to your site. On top of this will be a look at common problems Joomla! site developers face and how best to deal with them.
You will also learn techniques for building a business with Joomla!, as you step through building a subscription-based web business. Towards the end, you will look at marketing and monetizing this business fully to maximize your return.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Seitenzahl: 403
Veröffentlichungsjahr: 2009
Copyright © 2009 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, Packt Publishing, nor its dealers or distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: August 2009
Production Reference: 1180809
Published by Packt Publishing Ltd.
32 Lincoln Road
Olton
Birmingham, B27 6PA, UK.
ISBN 978-1-847195-16-6
www.packtpub.com
Cover Image by Vinayak Chittar (<[email protected]>)
Author
Daniel Chapman
Reviewers
Lesley A. Harrison
Oland T. Whitecotton, III
Tom Canavan
Acquisition Editor
Douglas Paterson
Development Editor
Dilip Venkatesh
Technical Editor
Bhupali Khule
Indexer
Monica Ajmera
Editorial Team Leader
Akshara Aware
Project Team Leader
Lata Basantani
Project Coordinator
Rajashree Hamine
Proofreader
Jeff Orloff
Drawing Coordinator
Nilesh Mohite
Production Coordinator
Aparna Bhagat
Cover Work
Aparna Bhagat
Daniel Chapman started his career as an Oracle database consultant and trainer, working for various Australian universities, telecommunication companies, and also Oracle Australia. This work helped him develop a keen sense of the value of development standards and analysis processes.
After ten years in the Oracle arena, he wanted a change of pace, so he moved to Japan and started working in web development in 2004. He quickly picked up PHP, JavaScript, HTML, and CSS while experimenting with various CMSes.
Finally deciding on Joomla! as his CMS of choice, Daniel initially began working as a consultant, developing sites and producing a few small extensions before starting one of the first Open Source Extension Clubs: NinJoomla (http://www.ninjoomla.com). Eventually, he changed the club's name to Ninja Forge (http://ninjaforge.com), and both he and the club have since become quite well known in the Joomla! sphere.
While this is Daniel's first book as an author, he has been a technical reviewer on several books including Choosing an Open Source CMS (Packt Publishing) and Joomla! 1.5 Extension Development (Packt Publishing).
I would like to thank my wife, Kyoko, for her seemingly endless support of my work, even when it takes time away from us being together. I can't thank her enough for being there for me.
Also I would like to thank my parents for always believing in me, even when no one else would, giving me the confidence to keep going when otherwise I might have given up.
Lesley A. Harrison has more than ten years experience working in the world of IT, having served as a Systems Administrator for a multinational IT outsourcing company, and later a database administrator for a British utility company. Today, Lesley runs her own video gaming site, Myth-Games.com, and works as a freelance web developer. She has clients all over the world, running a range of Joomla!, WordPress, and other open source CMSes, as well as some custom-coded solutions.
Lesley is currently working on the Beginner's Guide to WordPress-MU, which will be published by Packt Publishing in December 2009.
I would like to thank my husband, Mark, for keeping the flow of coffee coming, and Moose, for many hours of fun.
Oland T. Whitecotton, III is a certified PHP and MySQL developer with over 8 years of experience. He has worked for the largest debt consolidation company in America, Credit Solutions, as well as media publisher Idearc (think Superpages.com) and the employment web site Monster.com.
Tom Canavan has been in the computer and IT industry for 24 years and is currently working as the Chief Information Officer for a new Internet Security Startup.
He is author of the Packt Publications book, Joomla! Web Security and the book Dodging the Bullets - a disaster preparation Guide for Joomla! Websites.
Setting up a basic Joomla! web site is a relatively simple process, and there have been many articles and books outlining the process. However, the next step proves difficult, and often expensive for most people, but it is the most important one. That is customizing the site to bring their vision fully to life. Understanding how and why to make these customizations, is essential to having a successful, professional site, but there has been very little written about how to take this step.
This book will help you to take your web site to this next step, guiding you through how to customize different parts and aspects of your site, allowing you to separate your site from the crowd of other Joomla! sites without having to pay an arm and a leg hiring developers to do it for you. It will also show you how to turn your site into a profitable business via these customizations.
You will be taken beyond the basics of Joomla!, and given an insight into the techniques and tools used by the professionals to rapidly develop unique, custom sites. This will enable you to develop your own professional-quality Joomla! site without assistance, saving you time and money. You will learn how modules, plugins, components, and templates are constructed, and how to make changes to them, giving you the confidence to make more elaborate changes to your site. On top of this will be a look at common problems Joomla! site developers face and how best to deal with them.
You will also learn techniques for building a business with Joomla!, as we step through building a subscription-based web business. Then we will look at marketing and monetizing this business fully to maximize our return.
Chapter 1The Skills Required to Customize Joomla!—You will be given a clear understanding of why Joomla! came to be and how it fits into the Internet ecosystem, and how the technologies of HTML, CSS, JavaScript, PHP, and MySQL fit together to help you produce your site.
Chapter 2Setting Up Our Environment—Here, you will be introduced some of the tools and the environment used by professionals to ensure that their work is done as swiftly as possible while still maintaining top quality.
Chapter 3Planning Our Site—Before we get into the actual building of the site, we will cover how to plan your site properly and why this is essential to a successful site. You will also be shown how to choose the best extensions for building your desired site.
Chapter 4Installing and Configuring Extensions—Here, you will see how to clean out a new Joomla! installation of unneeded content and extensions, then how to install and configure most of your extensions. We will also begin work on our example site.
Chapter 5Installing and Modifying Templates—Here we will show you how to find, choose, and then customize a template to match the needs of your site, making changes to the HTML, CSS, PHP, and images.
Chapter 6Customizing Modules—After templates we will look at how to customize the functionality and appearance of modules so that they can do what we need. You will be shown how a Joomla! module is designed and built.
Chapter 7Customizing Plugins—In a similar style to Chapter 6, we will look at how plugins operate within Joomla, and then at how to modify the output of a content plugin.
Chapter 8Customizing Components—The most difficult of extensions to modify, components, are made clear in this chapter. You will understand how to identify the differences between traditional style and modern style Joomla! components and then make changes to one to better suit our site.
Chapter 9Finding and Fixing Problems—Here we will look a some of the common problems Joomla! web site developers face, and the ways we can solve them.
Chapter 10Promoting and Tracking—In this chapter you will learn different methods for promoting and marketing your web site successfully, and how to track that success.
Chapter 11Monetizing Our Site—The final chapter will go over some different methods for monetizing your site, extending what we have done in our sample site.
You will need a correctly installed Joomla! 1.5 web site, and a working Internet connection.
This book is written for people with basic knowledge of Joomla!, who want to expand their skills and move from simply assembling extensions, and installing a template to truly customizing their own site.
Readers are expected to have functional knowledge of Joomla! and a very basic understanding of terms such as FTP, PHP, HTML, CSS, and JavaScript, even if they have no real knowledge of the workings behind these terms. This book does not cover topics such as installing Joomla! and extensions, or creating content.
The ideal reader is one who wishes to build a successful business web site using Joomla! and is interested in making as well as saving money by applying professional tools and techniques to the development, monetization, and marketing of their site. Non-business focused site owners can still benefit greatly from the book, however, if they wish to add a level of professionalism to their work.
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply drop an email to <[email protected]>, and mention the book title in the subject of your message.
If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or email <[email protected]>.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
Although we have taken every care to ensure the accuracy of our contents, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in text or code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us to improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the let us know link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata added to any list of existing errata. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or web site name immediately so that we can pursue a remedy.
Please contact us at <[email protected]> with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
You can contact us at <[email protected]> if you are having a problem with any aspect of the book, and we will do our best to address it.
Before we get into designing and building our new web business, it is important for us to understand how the Internet works and how Joomla! itself fits into the picture. This information will be critical to us later when we want to make changes to our site, or fix problems with it, because without this knowledge we will have little or no idea where to start.
To help us with this, we will look at:
The Internet is primarily based off on a client/server relationship, with client computers, mostly people at home or at their office, connecting to web servers, usually as part of browsing a web site.
Because the web servers are physically separated from the client computers, and could be thousands of miles away, Internet interactions are limited to distinct requests and responses to and from web servers. It doesn't happen instantaneously, like with a native application that is running on our computer. Even though some modern web sites and high-speed connections can seem almost to act like a native application, they still operate in the same way as other web sites, via request and response.
This difference is illustrated in the following figure:
When building a web site, the web developer will put all the files needed for the site onto the web server. Then when a person on their client computer visits the web site using a web browser, they don't actually go to the site. The reality is that the site comes to them. The client sends their request to the web server, the web server sends them a copy of all of the web pages and files that are needed to fulfill their request, and then their web browser assembles the files into a presentable web page, as illustrated in the following figure:
Why is this important? Because it is important to realize that when someone is interacting with our web business, they aren't interacting with it live, but only with its copy that was downloaded onto their computer. This will affect how we approach designing, building, and also fixing our web business.
Modern Internet advances, such as cloud computing, AJAX, caching, and the like have recently produced a growing number of instances that are slightly different to the model given above, or at least appear to be different. However, they all still follow the basic premise of request and response.
Originally, web pages consisted primarily of many individual files, each containing all the design information and data, and links to any images that needed to be displayed on a single viewable page. This information and data was, and still is, written in a language called HTML.
While many people refer to HTML as a programming language, it is in fact, as the name states, a markup language. That is a language that doesn't provide instructions on something to do (a program) but instead, tells how to display itself and the data it contains.
This means that HTML code by itself is not capable of actually doing anything except structuring and displaying static data in a certain way.
HTML works by putting the data inside tags, indicated with greater than and less than symbols, and these tags tell the reader (usually a web browser) how to organize the data structurally.
Some examples of HTML tags:
An HTML document almost always has at least the following tags:
The <head></head> tags are used to hold information about the document which affects the display of the data, but does not actually get displayed on the page itself, whereas the <body></body> tags contain the data that is to be displayed in the web browser.
HTML can also contain extra pieces of information inside the actual tags themselves, and not just between the tags. These bits of information are called attributes. The extra information in these attributes is used to provide extra features and functionality to the HTML when displayed. For example, links and images need to be told where to send people when clicked, or what image to load.
We probably noticed that the image tag, <img>, didn't have a closing tag with a slash in it. This is because some tags can be self closed if it doesn't make sense for them to have two tags, such as with our image. To self close a tag, simply put a slash as the last character in the tag.
This is far from a complete guide to HTML, as there are dozens, if not hundreds of guides to HTML online and in book form. Please look to them for more information HTML. Also recommended is the website www.w3schools.com for more detailed information on HTML and its descendant, XHTML.
We can also use a style attribute in our HTML code to add design elements to what is otherwise only a logical structure.
Originally, this was how most HTML was styled. However, it was quickly realized that mixing design information, structural information, and the data itself into the same file was dangerous and made updating the data difficult without affecting the design, and updating the design was difficult without potentially affecting the data. So an attempt was made to strip the design information out of the HTML files, leaving only the data and data structure in the original files, and putting the design information into separate files.
This led to what is today called cascading style sheets (CSS), separate files containing the majority of the design information for a web page:
Server-side scripting is a web server technology that replaces the use of static, unchanging HTML pages with dynamically generated HTML pages. The pages are generated by scripts on the server (hence the name) when requested and passed back to the browser.
These dynamically generated pages have a number of significant benefits over static pages:
There are many different languages that can be used for server-side scripting, but since Joomla! uses PHP, so we will be focusing our studies there.
A dynamic, PHP powered, site's structure differs from a static web site in several key ways:
Because PHP runs on the server, our client browser only ever downloads the already generated HTML and never sees, nor even knows about, the PHP.
Joomla!, like most PHP sites, uses the file index.php as the primary gateway to a site. This file receives the requests from the browser and then calls the appropriate PHP functions needed to create a page that matches the request. However, please note that we will usually never change any of the code inside a Joomla! site's index.php file because all it does is call other files, many of these are template or extension files. It is the template and extension PHP files that we will usually be editing.
Joomla! templates also include an index.php file. This index.php file and the Joomla! core index.php file are different and serve different purposes. Editing a template's index.php file is a very common practice, unlike the core Joomla! file. Be careful when you start opening any index.php files to make sure you are editing the right one.
As mentioned above, most PHP generated sites, including Joomla! use a database to store their raw data. This makes it much easier, and faster, to retrieve data when it is requested by the user. It also allows powerful data operations and functions to be performed on the data if needed, such as aggregating it, sorting it, or making it easier to read.
The most common database for PHP sites, and the one used by Joomla! is MySQL. It is popular because not only is it open source and requires no cost to download and install, but it is also very reliable and powerful.
PHP code is designed to operate in two main methods. First, it can be run as complete PHP file. Usually these files are used for data processing, function declarations, or other unseen work.
The other method is to embed PHP into HTML code, usually to add loops, conditions, and load data into the otherwise static HTML, and usually these mixed HTML/PHP files are used as templates, or parts of templates, for displaying data on a site.
PHP can be easily recognized by the telltale <?php … ?> tags around sections of code. These tags are needed to complete PHP files and appear at the very start and end of the file. However, in a mixed HTML/PHP file, there are usually many, shorter code sections and tags.
PHP is a detailed and complex language and there is no way we could cover it in any usable detail in this chapter. Instead, it is recommended again that you find some of the many great online and offline resources. One of the best sites to get PHP information is www.php.net, which contains a complete list of the available functions and commands for PHP. You can also pick up one of the great PHP books from Packt Publishing (www.packtpub.com/php-mysql)
The basic operation of a Joomla! site revolves around the index.php file, calling the PHP files for the extensions and template required by the client request, and then assembling the HTML code output by them into a page and then sending it to the client. Extension PHP files usually reside in a /components/com_componentname directory, /modules/mod_modulename, or /plugin/plugintype/plg_pluginname and templates in a /templates/templatename folder.
Plugins were not included in the preceding diagram because they execute at many different times throughout the site.
From Joomla! 1.5, the PHP code architecture has been converted into what is called a Model-View-Controller (MVC) architecture. MVC is an attempt to separate business logic from data and from the user interface, with the model representing the data, the view representing the user interface, and the controller representing the business logic.
This is easily seen with Joomla! Extensions, which will often have model, view, and controller subfolders containing the relevant MVC PHP files for that extension.
The files in the view folders are most likely to have PHP and embedded HTML files, and the model and controller folders should only contain fully PHP files.
For more information about PHP and MVC within Joomla! extensions, I highly recommend the book Joomla! Extension Development, also from Packt Publishing.
PHP does have limitations though. Its dynamically generated pages still look fairly static by the time they reach the client, and PHP operates on the server, so what do we do if we want some dynamic activities on the client?
This question brings us to client-side scripting, and JavaScript.
We should by now have a basic understanding of the main technologies and programming languages used by a Joomla! site. Enough at least to allow us to tell the difference between a CSS file and a JavaScript file, between PHP and HTML, and so on.
It is strongly recommended that anyone serious about his or her site take their studies of these technologies further and builds up their skills with them. Even if they themselves are not going to do most of the development, perhaps they have hired developers for example, understanding these things will still make communicating with those developers much easier.