Components

What Are Components?

A component is in fact a seperate 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 newsletter, a community system, a photo gallery, etc. You could think of all of these as being a seperate application. Everyone of these would make perfectly sense as a stand-alone system. A component will be shown in the main part of your website and only one component will be shown. A menu is then in fact nothing more then a switch between different components.

Structure

Components can be structured in a couple ways. Technically all that is needed for a component to work is the following:

/{your hub install}
  /components
     /com_{your component}
       {your component}.php

Note that the PHP file must be named the same as your component. So, if you had a blog component, the setup would look as follows:

/{your hub install}
  /components
     /com_blog
       blog.php

A more typical Joomla! component structure is presented below. Here, it follows a stricter convention of keeping the models, views, and controller separate.

/{your hub install}
  /components
     /com_{your component}
       /helpers
       /models
       /views
       index.html
       controller.php
       router.php
       {your component}.php

Created on , Last modified on

  • Copyright © 2022 Hubzero
  • Powered by Hubzero®