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

 Home arrow FAQs arrow How-To arrow How to create a Mambo Mambot?
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 528 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 Mambot? Print E-mail
User Rating: / 3
PoorBest 

How to create a Mambo Mambot?

The overview: You create a zip file that you can use to do an install using Mambo installer

What is needed: bot_yourmambot.php and bot_yourmambot.xml.  Use these two files to create bot_yourmambot.zip

What is bot_yourmambot.xml: This is a file that the installer need to know some info regarding your mambot and do the install

What is bot_yourmambot.php: This is a file where you put the logic of your mambot to be executed by Mambo

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

<?xml version="1.0" encoding="iso-8859-1"?>
<mosinstall version="4.5.1" type="mambot" group="content">
<name>YourMambotName</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>0.1</version>
<description>Some description of your mambot</description>
<files>
<filename mambot="yourmambot">yourmambot.php</filename>
</files>
<params>
</params>
</mosinstall>

Here is a more expanded info on params


<params>
<param name="youralign" type="list" default="center" label="Align" description="Select left, right or center">
<option value="right">Right</option>
<option value="left">Left</option>
<option value="center">Center</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 bot_yourmambot.php


Let say you want to just show "me, mambot hello" message in your content.  This is very simple version of a mambot like a "hello world" type you can expand on this to utilize the parameters as described above to add more customization to your mambot or add more complex routine.

It is only limit to your imagination!

<?php // beginning of your mambot
// must have to protect from potential security risk
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
// declare your global
global $published;
// triggers: onPrepareContent, onAfterDisplayTitle,, onBeforeDisplayContent, onAfterDisplayContent
// mambot will be call at "onPrepareContent" trigger
$ttype = "onPrepareContent";
// set which call back to use
if (strtolower($ttype)=='onpreparecontent') {
    $whichfunc="callback_mambot_in_content";
}
// register your mambot to the trigger and your function to be called
$_MAMBOTS->registerFunction( $ttype, $whichfunc ) ;
// Your functions to be call back
function callback_mambot_in_content( $published, &$row, &$params, $page=0 ) { 
    $id="";
    if (!$published) return false;
    if (isset($row->id)) $id=$row->id;    
    $row->text = $row->text . "me, mambot hello";
    return true;
}
// end of mambot
?>

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


Credit Counseling - Arizona Landscaping - Phoenix Landscaping - Renegade Motorhomes
Validate XHTML
Validate CSS