COAddOns project site-Add-Ons for MiaCMS, Mambo & Joomla CMS

 Home arrow FAQs arrow How-To arrow How to create a Mambo Module?
Pick Language to Auto Translate:
AR | BG | CA | CS | DA | DE | EL | ES | FI | FR | HI | HR | ID | IT | IW | JA | KO | LV | LT | NO | NL | PL | PT | RO | RU | SK | SR | SL | SV | TL | UK | VI | ZH | ZT
SiteMap :: Contact Us :: About Us :: Member Blog :: Newsfeeds :: How-To :: News :: CMS Info :: MosNews :: Web Tools :: IRC Chat  

Main Menu
Home
Forums
Downloads
CMS Category
Web Links
FAQs
Blog
MoseCMS
COAddOns Wiki
COAddOns Docs
Drupal resources
Who's Online
We have 532 guests online
MosCmenuTree

FAQs

Feature Sites
Web Hosting
Q's quickdeals
OpensourceCMS
CMS Matrix
Joomla Extensions
Joomla Templates
Login Form
Username

Password

Remember me
Password Reminder
No account yet? Create one
Donate
Support OngETC in making a small donation:
Syndicate

MosNewsWriter

How to create a Mambo Module? Print E-mail
User Rating: / 3
PoorBest 
How to create a Mambo Module?

The overview: You create a zip file that you can use to do an install using Mambo installer
What is needed: mod_yourmodule.php and mod_yourmodule.xml.  Use these two files to create mod_yourmodule.zip
What is mod_yourmodule.xml: This is a file that the installer need to know some info regarding your module and do the install
What is mod_yourmodule.php: This is a file where you put the logic of your module to be executed by Mambo

Here is a sample content would go in your mod_yourmodule.xml

<?xml version="1.0" ?>
<mosinstall type="module">
    <name>YourModuleName</name>
    <creationDate>mm/dd/yyyy</creationDate>
    <author>Your Name</author>
    <copyright>This module is released under the GNU/GPL License</copyright>
    <authorEmail> </authorEmail>
    <authorUrl>http://www.yoursite.com</authorUrl>
    <version>1.0</version>
    <description>Some description of your module</description>
    <files>
        <filename module="mod_yourmodule">mod_yourmodule.php</filename>
    </files>
<params>
</params>
</mosinstall>

Here is a more expanded info on params

<params>
<param name="ButtonName" type="radio" default="1" label="A button" description="Display radio button">
    <option value="0">option1</option>
    <option value="1">option2</option>
  </param>
  <param name="items" type="text" default="0" label="How Many?" description="Display text" />
  <param name="style" type="list" default="" label="Style" description="Display a list">
    <option value="one">One</option>
    <option value="two">Two</option>
  </param>
</params>

Note: There are more type available but I don't have them all here you will need to hack the code to find out more or when I do I will update this article later.

Here is a content would go in your mod_yourmodule.php
Let say you want to get some data from your database and I just use my comments table as an example here. This is very simple version of a module like a "hello world" type you can expand on this to utilize the parameters as described above to add more customization to your module or add more data validation routine. It is only limit to your imagination!

<? // beginning of module
// must have to protect from potential security risk
defined'_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
// declare your database
global $database;
// get the latest 5 comments
$qry="SELECT * FROM #__content_comments WHERE published = '1' ORDER BY id DESC LIMIT 5";
$database->setQuery($qry);
// get and load the records from the query
$rows $database->loadObjectList();
// process each row, build and print the URL of the comment
foreach($rows as $row) {
$thisurl="index.php?option=com_content&task=view&id=".$row->articleid."&Itemid=1&show=1";
echo 
"<a href=\"$thisurl#comments\">".substr($row->entry,0,20)."...</a><br>";
}
// end of module
?> 

That's it and enjoy!
Comments

There are no comments yet. Feel free to add one using the form below.

You are not authorized to leave comments. Please login first.
<Previous   Next>




Sponsors

Reseller hosting (free)

000webhost (free)

HostUpon (w/ ssh)

Hosting24 (w/ ssh)

Free TK domain

CO.CC:Free Domain

Get Chitika Premium

Free Windows Hosting


Nevis Hotel - Credit Card Consolidation - Credit Counseling - Nevis Hotel
Validate XHTML
Validate CSS