Download (pdf)


The largest and most complex of the extension types, a component is in fact a separate application. You can think of a component as something that has its own functionality, its own database tables and its own presentation. So if you install a component, you add an application to your website. Examples of components are a forum, a blog, a community system, a photo gallery, etc. You could think of all of these as being a separate application. Everyone of these would make perfect sense as a stand-alone system.

Throughout these articles, we will be using {ComponentName} to represent the name of a component that is variable, meaning the actual component name is chosen by the developer. Notice also that case is important. {componentname} will refer to the lowercase version of {ComponentName}, eg. "CamelCasedController" -> "camelcasedcontroller". Similarly, {ViewName} and {viewname}, {ModelName} and {modelname}, {ControllerName} and {controllername}.


In the com_drwho example component, we demonstrate working with an MVC structure, basic usage of the database ORM, and more. The admin and site examples show how to output a listing (with pagination) and a form for entering new items and how to save to the database.

Other examples included are using multiple controllers, using models, handling errors, adding some security, and pushing assets (e.g., CSS) to the document.

Example usage of the API is also included.

Download: Doctor Who component (single model, single controller)
This is a basic example including a single database table, one model, and a single controller. Included are examples of the front-end, admin interface, and API.

Download: Doctor Who component (multi-model, multi-controller)
This is a more complex example including multiple database tables, multiple inter-dependent models, and a couple controllers to demonstrate division and organization of code. Included are examples of the front-end, admin interface, and API.

Last modified: