MosModule FAQ

MosModule FAQ and How-To

MosModule: Ads rotator using MosModule

+ Please make sure to not use WYSIWYG editor which might mess up your ads code
+ Assuming you already install MosModule and MosModuleMod and assign MosModuleMod to bottom position would be best in this case

Here are what you have to do:

1. Setup an ads section and category
2. Create one article per ads which you can paste your ads code in them best result not use WYSIWYG
3. Once you have your articles that contain ads in place you can use MosModuleMod to help you to show MosModule in a module and use {mosmodule random=articleID}

Further explanation on the steps 3, it uses MosModuleMod to run MosModule random command that pull articles that contain ads code that you created on step 1 and 2.

Now you will have different ads show on different page view and still honor your ads exclusive agreement on a give page.

That's it and enjoy!

MosModule: Can MosModule be used in custom HTML module?

Will MosModule execute its command in custom HTML module?
The answer is Yes and No.

No, all the latest version of Mambo, Joomla MiaCMS or any of the forks won't parse mambots in custom HTML module by default but there is a way!

Yes, it can! But with a special module call MosModuleMod

How you might ask?

Assuming you already install MosModule and MosModuleMod!

First you create an article that you would enter all your custom HTML module code in your article then make note of the article ID.

Then you go to your module manager look for MosModuleMod and enter to "MosModule command:"


That's it!

Now your article will be running as custom HTML module in a module!

MosModule: Grabpage command

This article show how to use MosModule "grabpage" command. This command is use when you need to pull content from other URL whether from your own site or from other site.

Here is the actual code that pull content from demo site:

{mosmodule grabpage=}

You can see the sample here:

MosModule: How to embed video in content?

With MosModule, it is very easy! You just use the "video" or "flash" command to embed video like this:

{mosmodule video=URLtoVideo}
{mosmodule flash=PathToLocalFlashFile}

Here are some working example streaming video from local file and from YouTube, Yahoo Video, Google Video.

Video from local swf file

{mosmodule flash=files/bamboo.swf,300,300}

Video from YouTube

For example:

Get the "src" and enter like below:

{mosmodule video=,300,300}

Video from Yahoo

Note: You will need to do a little extra work to figure out the correct url to put into MosModule.

For example:

You will need to add the value that you get from the "src" and "flashVars" together like below:

{mosmodule video=}

Video from Google

For example:

Get the "src" and enter like below:

{mosmodule video=}

Please see a working sample here:

MosModule: How to embed video w/ ReMository?

You just need to download the latest version of ReMository and the latest Quickdown. After you install Remoistory and Quickdown and make sure you enable Quickdown mambots then you do the following:

Here is the code to show the video:

{mosmodule video=,300,300}

Here is the code to show your download item from ReMository:

You can see a working sample here:

MosModule: How to hack CB to parse MosModule in CB tab?

In summary what you need to do is:
. Look for this function in CB: getViewTabContents
. wrap around the return variable with a call to mosmodule_bot in mosmodule_func.php
. That's it!

With this hack you can now use any mosmodule command in CB tab.

For example: {mosmodule author=admin}

Here are the detail:

On line 3196 of comprofiler.class.php

return $return;

With these:
global $mosConfig_absolute_path;
if (file_exists($mosmodulefunc)) { include_once($mosmodulefunc); }
if (function_exists('mosmodule_bot')) { return mosmodule_bot($return); }


MosModule: How to show contact form in content?

Here are the steps:

1. You just create an menu item to point to your contact form.

2. Obtain the URL of your contact form menu item. It will look something like this:

3. Creat a content page and enter this code in the content
{mosmodule grabpage=}

Note: I replace index.php with index2.php from the above URL that I obtain earlier!

That's it!

Now that when you view your content page it will show your contact form in it.

You can see a working sample here:

MosModule: How to use snippet?

What is snippet?

Snippet is just php code that MosModule will execute just like you put php in your article but without all the php intermix inside your article. It turn your article into php program! Another words snippet is inline PHP code but nicely file away and just reference it with an article ID.

How to use snippet?

First you just need to create a content that you can put your php code in it but without < ?php ? > and give it a name and take note of the article ID.

Then in the article that you want to use snippet just do something like this:

{mosmodule snippet=ArticleID}

You can call as many snippet as you want just like you would with php function but in this case it is more of a block of php code that you want to run in your content.

The thing that you need to be aware is that all your variables that executed in any snippet will be available through out your content.

What is that mean, it mean you can define function in any of the snippet that you execute prior in the later snippet calling!

You can even add some HTML code in your article to wrap around your snippet if your snippet output something! This will help to do code and design separation!

It is open for all kind of possibilities!

MosModule: Show MosCom latest 5?

It is very easy with MosModule, you just create an article to contain the snippet then another article to execute it.

Here are the steps:

First you create an article that contain this snippet code:

# Code snippet listing for MosCom latest 5, let say this is article ID=232
global $database;
$qry="SELECT name, entry, `date` FROM `mos_content_comments`";
$qry.="WHERE published='1' ORDER BY `id` DESC LIMIT 5 ";
$rows = $database->loadObjectList();
foreach ($rows as $row) {
echo nl2br($row->entry);
echo '';
echo '';
echo 'Posted by: '.$row->name;
echo ' on '.$row->date.'';
echo '';

Then in another article just enter this: {mosmodule snippet=232}

The above line will execute the snippet and show MosCom latest 5 comments

You can apply the principle of this sample code but replace with your own logic to make it do anything you want in Mambo. The beauty of this way of doing thing is you have access to all Mambo API, variables, etc. You don't have to develop a module and worry about xml, etc.

With this method you can quickly hack up something that tailor or extend the function that you want without needing to spend the time to develop a plugin, addons, etc.

Enjoy with MosModule snippet!

Here is the running sample:

MosModule: Show content in a module

It is extremely simple to do!

Assuming you already install and enable Mambot MosModule and Moddule MosModuleMod then below are the steps you need to do to make it happen!

. Create an article to store your content that you want to show in a module like a message of the day, notice board, annoucement, etc.

. Write down the article id because you will need this in the next step

. In the MosModuleMod where you see "MosModule command:", you enter: mosmodule articleid=id

Further explain, the above line will execute MosModule command and show the article in a module.