Joomla! 1.5x Customization: Make Your Site Adapt to Your Needs - Daniel Chapman - E-Book

Joomla! 1.5x Customization: Make Your Site Adapt to Your Needs E-Book

Daniel Chapman

0,0
34,79 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.
Mehr erfahren.
Beschreibung

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:

EPUB

Seitenzahl: 403

Veröffentlichungsjahr: 2009

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Table of Contents

Joomla! 1.5x Customization
Credits
About the Author
About the Reviewers
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Errata
Piracy
Questions
1. The Skills Required to Customize Joomla!
The architecture of the Internet
HTML
CSS
Server-side scripting and PHP
MVC programming and PHP
Client-side scripting and JavaScript
Asynchronous JavaScript and XML (AJAX)
JavaScript frameworks—Mootools and jQuery
Database work with MySQL and SQL
Summary
2. Setting Up Our Environment
Types of tools
File transfers
Code editing
Image editing
Web browsing
Database administration
Storing code
Checkout
Update
Commit
Add
Delete
Revert
Ignore
Building locally
Practical—picking our tools
Practical—using our tools
Inspect Element
Summary
3. Planning Our Site
Why is it so important to plan?
The Frankensite effect
No one can hit a target they don't have
How to plan
Mission
Practical—write our own mission statement
Monetization
Practical—decide our monetization model
Goals
Practical—set our goals
Licenses, encryption, and commercialism
Licenses
Open source
Proprietary
Encryption
Commercialism
Using the Joomla! Extensions Directory and Google
Choosing extensions from our goals
Practical—turning goals into extensions
Display audio and video
Submit pictures of customers' own house to a public gallery
Ask questions to each other and discuss topics
Grow an income from ad-supported free members and subscriptions
Customer comments on our articles
Ability to collect, moderate, and display user testimonials
Convert default web page URLs to human-readable links
Essential extensions
NinjaXplorer
JoomlaPack
JCE
EasySQL
Summary
4. Installing and Configuring Extensions
Configuring Joomla!
Core extensions
Components
Modules
Plugins
Global Configuration
Configuring content sections and categories
Clearing out the sample content
Creating sections
Creating categories
Buying in Japan
Renting in Japan
General Housing Matters
Configuring extensions
AEC
Subscription plans
Payment gateways
General Configuration
Customization
Micro Integrations
Authentication plugins
PayPal
Creating subscription plans
Joo!BB
Configuring boards
Overall Configuration of Joo!BB
Configuration details
Board settings
Latest post settings
Feed settings
Attachments
View settings
View footer settings
Registration User Settings Defaults
Avatar settings
Captcha settings
!JoomlaComment
General
Security
Posting
Layout
Ninja Custom Gallery
Categories
Custom fields
Buildings
Gardens
Interior
Galleries
Settings
sh404SEF
Other extensions
Summary
5. Installing and Modifying Templates
Finding a template
Choosing a template
XHTML and CSS validation
Template structure
Extra features
Browser compatibility
Typography
Template performance
Installing a template
Modifying a template
Template images
Image considerations
Image compression and formats
When images aren't visible
Originality and copyright
Finding and modifying images
Vector and bitmap images
Modifying our sample site images
Logos
The showcase area images
Favicon
Template PHP
Editing PHP files
Editing our sample site's PHP
Template CSS
Editing CSS files
Editing our sample site's CSS
Summary
6. Customizing Modules
Module construction and operation
Module in a module
Module customization
Modifying top ten members
Step 1: Understanding the existing code
en-GB.mod_fbmodule.ini
helper.php
index.html
mod_fbmodule.php
/tmpl/default.php
mod_fbmodule.xml
readme.txt
Step 2: Plan out our changes
Decide our changes
Mark out our changes
Step 3: Make our changes
helper.php
tmpl/default.php
mod_fbmodule.php
mod_fbmodule.xml
Step 4: Install and test our module
Summary
7. Customizing Plugins
Plugin composition and operation
Plugin types
Authentication
Content
Editors
Editors-XTD
Search
System
User
XML-RPC
Plugin events
Plugin order
Customizing a Plugin
Step 1: Understand the existing code
en-GB.plg_content_njaccess.ini
Description handling in Joomla! Plugins and modules
Our custom Plugin description
njaccess.php
njaccess.xml
The rest?
Step 2: Plan out our changes
Step 2.1: Decide on our changes
Step 2.2: Mark out our changes
en-GB.plg_content_njaccess.ini
njaccess.php
njaccess.xml
Step 3: Make our changes
en-GB.plg_content_aecsubshider.ini
aecsubshider.php
aecsubshider.xml
Step 4: Install and test our Plugin
Summary
8. Customizing Components
Component composition and operation
Out with the old, in with the new—MVC
Before MVC
After MVC
Execution flow for components
Customizing components
Customizing component output
Change 1: Adding rounded corners to the forum
Change 2: Replace the heading background
Change 3: Replacing the buttons
Summary
9. Finding and Fixing Problems
Understanding common errors
PHP code
Incorrect extension parameters
Diagnosis
Fixing the problem
PHP code error
Diagnosis
Fixing the problem
PHP version
Diagnosis
Fixing the problem
Server settings
Diagnosis
Fixing the problem
JavaScript code
Library conflicts
Diagnosis
Fixing the problem
Same library loaded twice
Different libraries loaded
Too much JavaScript
Diagnosis
Fixing the problem
Multiple "once per page" scripts
Diagnosis
Fixing the problem
Hacking the core
Solving the unsolvable
Self support
Search the support forum
Search the Internet
Read the Manual/FAQ
Ask a skilled friend
Support requests
Forums
Tickets
Email
Support request etiquette
Act like we respect the helper and their time
Choose our forum/category/email target carefully
Write a useful, meaningful subject line
Please help/I need help/can someone help me/help me!!!!!!!!!!
Urgent/help now/important
Slideshow module doesn't work
Magic Slideshow V1.02—no animations due to JavaScript error
Provide as much information as possible
Summary
10. Promoting and Tracking
Promoting our site
SEO
Web page URLs
Content
Metadata
Images on our site
Image alt text
Title text
Text surrounding the image
File name
Inbound links
Outbound links
Traditional marketing
Advertisements
Mailing list
Article marketing
Press release marketing
Social marketing
Blogging
Social networking sites
Twitter (www.twitter.com)
Facebook (www.facebook.com)
LinkedIn (www.linkedin.com)
MySpace (www.myspace.com)
Tagging and Social Bookmarking sites
Forums and comments
Tracking visitors to our site
Google Analytics
Tracking visitors
Summary
11. Monetizing Our Site
The Internet and the free economy
Monetization models
Advertising
Google Adwords
Other advertising services
Private advertisers
Affiliate advertising
Selling information
Selling products
Selling services
Monetization implementations
Freemium
Cross subsidy
Advertising removal
Monetization models for our site
Advertising
Google Adwords
Private advertising
Affiliate advertising
Professional services
Subscriptions
Extra content
Advertising removal
Site benefits
Status
Discounts on services
Discounts from partners
Summary
Index

Joomla! 1.5x Customization

Make Your Site Adapt to Your Needs

Daniel Chapman

Joomla! 1.5x Customization

Make Your Site Adapt to Your Needs

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]>)

Credits

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

About the Author

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.

About the Reviewers

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.

Preface

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.

What this book covers

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.

What you need for this book

You will need a correctly installed Joomla! 1.5 web site, and a working Internet connection.

Who this book is for

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.

Reader feedback

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.

Customer support

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.

Errata

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

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.

Questions

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.

Chapter 1. The Skills Required to Customize Joomla!

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 architecture of the InternetHTMLCSSServer-side scripting and PHPClient-side scripting with JavaScriptDatabase work with MySQL and SQL

The architecture of the Internet

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.

Note

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.

HTML

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:

<h1>This is a level 1 Header</h1> <p>This is a paragraph</p> <div>This is a div, used to divide information into logical containers.</div> <ul> <li>A List Item (li) in an unordered list (ul).</li> </ul> <span>This is a span of text. </span>

An HTML document almost always has at least the following tags:

<html> <head></head> <body></body> </html>

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.

<a href="www.awebsite.com">A link to a website</a> <img src="www.awebsite.com/logo.jpg" />

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.

Note

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.

<span style="color:red; font-weight:bold; background-color:yellow">It's an emergency!</span>

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 and PHP

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:

Easier maintenance, because there is usually only a single copy of any site-wide HTMLContent can change and react to user preferences or inputContent can be added or changed without changing any HTMLSites are often constantly evolving and improving as users and developers alike add content to the site via dynamic communication technologies such as forums or commentsMuch faster to make updates to the entire site layout

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:

There is usually only one main file that is ever called from the browser, almost always named index.php, and different pages are generated according to parameters passed to the server from the client.Usually a database or data files of some sort are used to separate the raw data from the HTML, and they are then assembled upon the user's request.A PHP web site only sends generated pages to the client. Pages that do not actually exist on the server as a file in the form that the client receives them. However, most static HTML sites send exact copies of the HTML files that are on the server.Instead of a mass of HTML files, there are usually fewer files, and they contain mainly scripting code, and much less HTML.

Note

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.

Note

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.

Note

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.

Note

Plugins were not included in the preceding diagram because they execute at many different times throughout the site.

MVC programming and PHP

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.

Note

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.

Summary

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.

Chapter 2. Setting Up Our Environment