I written a module with a small form and this can submit every registred user, i insert this data in a extra table named: #__trackitems

I created a component with 1 view "tracks", the component is successfully added in navigation as menu item, i want now to get simple list with items from the table #__trackitems, view file is created and i see my static html, but what have i to do in model and controller? I tried more times to see how it is done in "com_content, com_k2 and com_weblinks" but i really not understand how to continue?


1 Answer 1


You should: Create model Tracks in models folder in your component containing a class YOURCOMPONENTModelYOURVIEW for example TracksViewItems. In this class add a public function called getItems(). Add all the code so this function will return array of items from your database table. Then in your view.html.php in display() function use this $this->items = $this->get('Items') to get a list of items from database. Now you can use $this->items property in your default.php of your view to get all the items.


If your component is called com_tracks and view is called list your model should be in: /components/com_tracks/models/list.php. Class name should be TracksModelList. Your view should be in /components/com_tracks/views/list/view.html.php and the view class name should be TracksViewList. In /components/com_tracks/view/list/tmpl/default.php you should insert all the code (html/php) for displaying your data from $this->items property.

Sample component tutorial:

Developing a Basic Joomla! component

  • Many thanks, sometimes are practical steps much more better :)
    – Caner
    Commented Jul 5, 2015 at 10:13
  • Link is now useless
    – AdRock
    Commented Jul 11, 2017 at 12:12
  • The link is not useless but broken. Already fixed it. Commented Jul 11, 2017 at 15:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.