Saturday, April 29, 2006

From database to web page

Here's a tiny module to get data from the Joomla database and display it on the front Joomla! page. Take the zip file and install the module. It will will list the published modules and their positions, one per line. The file contents is given below.

[Note: There's a Mambo module tutorial that has almost the same thing.]

mod_getandgive.php:

<?php

defined
( '_VALID_MOS' )
or die(
'Direct Access not allowed.' );

$query = "SELECT * FROM jos__session";
$database->setQuery( $query );
$result = $database->loadResult();
echo
"result: " . $result;

?>



getandgive.xml:
<?xml version="1.0" ?>
<mosinstall type='module'>
<name>getandgive</name>
<creationDate>19/Jun/2006</creationDate>
<author>Mr. Hello Smiley</author>
<copyright>This template is released
under the GNU/GPL License</copyright>
<authorEmail>blackhole@saynotospam.com</authorEmail>
<authorUrl>http://readbangkokpost.com/business/</authorUrl>
<version>1.0</version>
<description>To get something from the Joomla database
and display it in a box on the front of Joomla</description>
<files>
<filename module='mod_getandgive'>mod_getandgive.php</filename>
</files>
</mosinstall>

0 Comments:

Post a Comment

<< Home