Showing our data in our module
Now that we have inserted some data into the database, it's the best time to modify our module and enhance it to show this data in our module position.
At the moment, mod_tinynews
is only showing the "This is
working" message, which obviously is useful for nothing. Let's enhance it.
The first file that we are going to modify is
modules/mod_tinynews/helper.php
, as follows:
<?php defined('_JEXEC') or die('Direct Access to this location is not allowed.'); class ModTinyNewsHelper{ function getallnews(){ $database =& JFactory::getDBO(); $query = "SELECT * FROM ".$database->nameQuote('#__ tinynews').";"; $database->setQuery($query); $result = $database->loadObjectList(); return $result; } }
Looks familiar? It's the same method we used in our component frontend model.
It will be useful for here too. We will call this method in our
...