InMotion Hosting Support Center

This tutorial series, Joomla 3 component development, is currently in progress...

So far in this tutorial series for creating a component in Joomla 3, we've created views and we've created formats. The next feature of components we're going to review is tasks.

What is a task?

A task is, well... something that can be done. The usage of "tasks" when developing components in Joomla is what it sounds like.

display() is the default task

If you do not specify a task, the default task display() will be executed. The screenshot below demonstrates this in action. When we echo the task to the screen, it is blank (meaning it is not set). Because there is no task set, the default() task / function is then executed.

How to add a new task

Adding a new task to your component is actually quite easy. Here are the steps.

  1. Decide on a task name

    In our testing, we are going to create a task named shout.

  2. Add a function named after your task within your component's controller class

    Since we're creating a shout task, we need to create a function named shout() and add it to our controller's class. Below is our controller.php file, with the new code we added to it highlighted in red.

    // No direct access to this file
    defined('_JEXEC') or die('Restricted access');
    // import Joomla controller library
     * Hello World Component Controller
    class HelloWorldController extends JControllerLegacy
      function shout()
        echo "<p>THIS IS ME SHOUTING!</p>";

Testing your new task

We're testing our new task by calling it in the URL. To do this, we're passing the task variable via the URL and setting it to shout, as in:

In the screenshot below, you can see our new task in action:

Was this article helpful?
Continued Education in Course How to create a Joomla 3 Component
You are viewing Section 6: How to add a New Task to your Joomla 3 Component
Section 5: How to add a New Format to your Joomla 3 Component
Section 7: Creating a Menu Item for your Joomla 3 Component

Joomla Community Google+ Hangout #3

June 3rd, 2014

Thank you @RustyJoomla for letting me speak on the Joomla Community Google+ Hangout!

Click here to watch!

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Support Center Login

Our Login page has moved, Click the button below to be taken to the login page.

n/a Points
2016-12-23 1:39 pm


if your url was

where would you put the shout function? Is it still in the controller or does it have a sub folder? If it's in a file in a sub folder is the folder's name helloworld or is helloworld the controllers name?

Thanks in advance for the answer if there is one!

(Sorry if the question is inappropriate or stupid.)

2,858 Points
2016-12-23 2:07 pm
Dashel, as you have the 'shout' currently referenced 'helloworld' would need to be a class, and 'shout' would be a method of that class. It's unlikely that it would be in sub-'folder'. As this issue has to do with the coding of your site or sites, it is outside of the scope of support that we are able to provide. You will want to work with an experienced web developer, if you don't have one already, to assist you with this further.
n/a Points
2016-03-25 5:55 am


i need to add featured type in my fof component , how to use it?

10,077 Points
2016-03-25 9:32 am
Hello Mathesh,

Can you please elaborate on what you are trying to do?

Best Regards,
TJ Edens
n/a Points
2015-03-11 10:03 am

Many thanks !

And how to do the same on the site part of the component ?

How to see it when we affect the type of link on the menu ?

many thanks for all.


42,432 Points
2015-03-12 11:08 am
Hello Pascal,

Your first question is a little confusing. Most components have two main parts: an administrator part and a site part. The site part is what is used to render pages of your site when they are requested by your site visitors during normal site operation. The administrator part provides an interface to configure and manage different aspects of the component and is accessible through the Joomla! administrator application.

So, when you render a page, it's already showing the SIte part of the component. Can you be more specific in what you're trying to do? Please provide more details and we can try to answer the question.

Arnel C.

Post a Comment

Email Address:
Phone Number:

Please note: Your name and comment will be displayed, but we will not show your email address.

6 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?


Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail:
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!