Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
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
Learning Joomla! 3 Extension Development

You're reading from   Learning Joomla! 3 Extension Development If you have ideas for additional Joomla 3! features, this book will allow you to realize them. It's a complete practical guide to building and extending plugins, modules, and components. Ideal for professional developers and enthusiasts.

Arrow left icon
Product type Paperback
Published in Jul 2013
Publisher Packt
ISBN-13 9781782168379
Length 458 pages
Edition 3rd Edition
Languages
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Timothy John Plummer Timothy John Plummer
Author Profile Icon Timothy John Plummer
Timothy John Plummer
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

Learning Joomla! 3 Extension Development
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
1. Before you Start FREE CHAPTER 2. Getting Started with Plugin Development 3. Getting Started with Module Development 4. Getting Started with Component Development 5. Backend Component Development – Part 1 6. Backend Component Development – Part 2 7. Frontend Component Development 8. Security – Avoiding Common Vulnerabilities 9. Packing Everything Together 10. Extending your Component with Plugins and Modules Index

Coding standards


The Joomla! coding standards are based on the PEAR coding standards with some small variations. You can see the full details on the developer site at http://developer.joomla.org/5-policies/3-Joomla-Coding-Standards.html.

The first thing to note is that Joomla! uses tabs for indenting and not spaces. The encoding on files must be set to UTF-8, as some other languages need this encoding to display all the different characters, and it is important that Joomla! supports multiple languages.

The closing PHP tag ?> at the end of each file should be left off; your web server is going to automatically handle this, and by leaving it off, you prevent accidental whitespace.

Joomla! uses the Allman style for braces, so the opening brace is on the next line.

if (x == y)
{
  //do something
}

This is unlike the PEAR coding standards which use the K&R style where the opening brace is on the first line.

if (x == y) {
  //do something
}

There are still some minor inconsistencies with the standards used in the core code, but this is improving with each version. It's always best to make your code as similar in style to the core code as possible, as it will make it easier for other people to customize your code to suit their purposes. There is nothing worse than wanting to make a minor change to an extension and finding that the developer's code looks nothing like what you are familiar with, so you waste a lot of time just trying to reverse engineer it. The core components that are mostly like third-party extensions are Weblinks (com_weblinks) and Banners (com_banners); it's a good idea to use these as a reference point. It should be noted that any IDE worth its salt can reformat the code to suit the operator's preference, so minor formatting problems are only really an issue if you are using a basic text editor.

You have been reading a chapter from
Learning Joomla! 3 Extension Development - Third Edition
Published in: Jul 2013
Publisher: Packt
ISBN-13: 9781782168379
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