Advertisement
Free Mambo Templates - Free Joomla Templates
Joomla Hut HomeContact UsJoomla LinksMambo Forum - Joomla ForumJoomla Downloads
Home
News
Articles
Gallery
Downloads
Tutorials
Site Reviews
Flash Tutorials
Templates Demo
Joomla Links
FAQ
Submit News
Advertise Here
Search
Advertisement
Seek Your Host
New York Web Design
Joomla Templates
Login Form





Lost Password?
No account yet? Register
Joomla Extensions
Joomla Templates
TemplatePlazza
 
Joomla Website

Creating a quick and easy Mambo component Print E-mail
Written by Doyle Lewis   
Thursday, 15 April 2004

 

hello_world.php - Frontend display

<?php
//hello_world Component//
/**
* Content code
* @package hello_world
* @Copyright (C) 2004 Doyle Lewis
* @ All rights reserved
* @ hello_world is Free Software
* @ Released under GNU/GPL License :
http://www.gnu.org/copyleft/gpl.html
* @version 1.0
**/

defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

global $database;
$query = "SELECT * FROM mos_hello_world LIMIT 1";
$database->setQuery( $query );
$rows = $database->loadObjectList();
$row = $rows[0];

echo $row->text;

?>

Now let's look at how the file works:

defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
This makes sure Mambo is calling the file. Very important for security.

global $database;
Sets $database as a global variable so you can use it within your function.

$query = "SELECT * FROM mos_hello_world LIMIT 1";
Selects the first entry in the mos_hello_world table in the database.

$database->setQuery( $query );
Maps your query to the $database class.

$rows = $database->loadObjectList();
Creates a variable named $rows that stores all of the database information as an array.

$row = $rows[0];
Creates a variable named $row that stores only the first value in the $rows array.

echo $row->text;
Writes the value for text to the screen.

 


 
< Prev   Next >
 
 
Joomla Jobs
 
 
Joomla Flash Tutorials
   
     
Home   |   Contact   |   Links   |   Forum   |   Downloads  |  Media Kit
 

© Copyright 2003 - 2006 by BUYHTTP, LLC. All rights reserved.
None of the text or images in this public website may be copied without the expressed written consent of the authors.
Powered By Joomla!

Joomla Top Sites - Your Primary Source of Joomla Traffic