Joomla 1.0 Articles
- How to create a module with DirectPHP plugin?
- How to include modules in Content item?
- How to include modules in Section/Content Description
- How to include PHP commands in Section/Content Description
- How to make plugins process Section/Category descriptions
- Include Code Listing plugin - More Tips and Techniques
- How to have DirectPHP plugin process RSS feed?
Joomla 1.5 Articles
- How to create a module with DirectPHP plugin?
- How to include modules in Content item?
- How to include modules in Section/Content Description
- How to include PHP commands in Section/Content Description
- How to make plugins process Section/Category descriptions
- Include Code Listing plugin - More Tips and Techniques
- How to have DirectPHP plugin process RSS feed?
|
How to create a module with DirectPHP plugin (for Joomla 1.0.x) |
| Written by kksou | ||
| Thursday, 27 March 2008 | ||
|
You can easily create Joomla modules using the DirectPHP plugin. In this article, I will show you how to create a module similar to the Most Popular module (mod_mostread) that comes with the standard Joomla installation. Our version of "Most Popular" module has one additional enhancement: it will list the total number of hits for each listing as shown below:
Note: the steps below works for Joomla 1.0.x only. For Joomla 1.5.x, please refer to How to create a module with DirectPHP plugin (for Joomla 1.5.x). Here are the steps to create a Joomla module
<?php
global $database;
$query = "SELECT * FROM #__content ORDER BY hits DESC limit 0,10";
$database->setQuery( $query, 0, $count );
$rows = $database->loadObjectList();
echo '<ul>';
foreach($rows as $row) {
echo "<li>$row->title ($row->hits views)</li>";
}
echo '</li>';
?>
Note: Please make sure you're only doing this on your development machine. It's too dangerous to do this on a live machine, unless you're the only one managing your website.
Of course the above code is extremely simplified. I just want to show you that creating a Joomla module using DirectPHP plugin is simple and straightforward. If you want, you can refer to mod_mostread.php and put in a more complex database query that checks access control, whether it's published or not, and adds a link to the article, etc. User reviews There are no user reviews yet. Note: You have to be a registered member to leave a comment. Free registration here. |
||
| < Prev | Next > |
|---|







