MosModule

The hightlight of this new release are:
* Add a "nostate" switch to bypass "state" in articleid
* add | as delimiter to support "," in parameter
* add introtext to readmore instead of number of words
* change MM back to mosmodule which cause lot of confusion for people
* add alias support to predefine mosmodule command to override the default value via mosmodule.ini
* add reference to article ID or URL
* add support for itemid in readmore command
* add support for escape comma in parameter like \,
* add support space between comma in parameter
* add parameter support for alias file name
* add multiple parameters support in alias definition
* minor fix on correctly handle comma when use | as command separator without needing to escape comma
* null out any left over %s in alias
* minor change on SEF to deal with J15
* add support for MosPrayer

Description:
* MosModule mambot has the ability to display nested article, author, textsizer, embeded video in a content, exec snippet written in PHP (without < ?php ? > tags) and exec external php script file pass with parameter (with < ?php ? > tags). You can see an example of that in "mosmodule\hello.php". (See more detail below)
* In my mind, MosModule would give me the potential of reusing article that are common to all article without repeating the same content, make my article more dynamic enrich with php code using snippet or external php script file. With the use of the parameters and querystring you can pass variable between mosmodule and the external php script. The possibilities are endless!

Features & Usages:
* Run as legacy mambot support and ability to run inside module (see below)
* MosModule is a mambot to displays any module, article, textsizer, video, exec snippet and external php script inside a content item, grap content from any url, wrapper to wrap any site into your site, rss feed, Gigcalendar, MosQbot
* external script: Please see hello.php for a sample on passing variable between mosmodule and external script
* Add feature to self parse mosmodule bot
* Add support for mosimage in load article and author
* Add support for Nok Kaew and JoomFish in load articleid
* Show MosModule in section/category description (see readme_advance.txt).
* Support mod_mosmodule that call mosmodule mambot in module
* Integrate with MosCom with ability to place comment link any where in content

Note:
* Important: Make sure to save the setting at least once and enable MosModule in Mambot manager!
* This is a rewrite of modulebot to be compatible with MiaCMS, Mambo 4.5.1 or above, Joomla 1.0 and 1.5 with legacy enable
* The default folder for external script is "mosmodule" but you can change it in param screen
For example: /home/user/www/mosmodule
* Snippet should not have < ?php ? > tags where as phpinc should have the tags
* By default, the module will fill the width of the content area. If you wish to control the width and positioning of modules in content area, you will want to enclose the mosmodule tag(s) in a div and either assign a class to controll the display in your template_css.css file, or use inline styles (if you are using a WYSIWYG editor, you will need to switch to source mode in order to create the tag).

Syntax: {mosmodule command} ---> see a list of available command below for more detail

Convention:
() optional parameter
[] default value
| can substitue , as delimiter when separate parameter in MosModule

>>> Advance usage: For more detail see mambots\content\mosmodule\advance_readme.txt

List of available commands:

# list
* Displays a list of available modules and block positions.

# module=modulename1,(module2,module3,etc)
* Displays module in a content.

# random=FAQ
* Displays the entire section randomly

# articleid=2
* Displays an article inside another article option to show readmore link when introtext in used

# readmore=2
* Displays an article inside another article with readmore link

# codeid=2
* Displays an article inside another article as code listing

# textsizer=idtag
* textsizer to resize text by passing the id tag of your content

# mosqid=2
* Display MosQ query id 2 in content

# gigid=2
* Display GigCalendar id 2 in content

# snippet=2
* Execute and displays an article inside another article as PHP code

# inc=hello.php,firtname,lastname
* Include and Execute external script such as javascript, php, html, etc in your content

# phpinc=hello.php,firtname,lastname
* Include and Execute external script such as javascript, php, html, etc in your content

# video=Video_url,(width,heigth)
* Default is width=390, heigth=280

# videoegg=VE_Path,(width,heigth)
* Default is width=390, heigth=280

# flash=videofolderpath/flashfile.swf,(width,heigth)
* Default is width=390, heigth=280

# rssfeed=url
* Show RSS Feed from others sites

# grabpage=url
* Show page from others sites

# wrapper=url,(width,height,scrolling,align)
* Default is width=100%, heigth=800px, scrolling=auto, align=top

# author=username,(5),(introtext|fulltext|[all]),(page,[nopage])
* Displays 5 articles by author using username inside another article

# moscom
* Display MosCom comment link any where in content

# ref=id or url
* Displays a reference to a title of an article or a URL

# alias (see readme_advance.txt for more detail)

Credit: see mambots\content\mosmodule\credit.txt

Info:

* Wiki: http://wiki.ongetc.com
* Support: http://support.ongetc.com/index.php?option=com_phorum&Itemid=175
* Download: http://support.ongetc.com/index.php?option=com_content&task=category&sec...

Any donation$ would be greatly appreciated. Thanks

MosModule advance usages and sample

Convention:
() optional parameter
[] default value
| can substitue , as delimiter when separate parameter in MosModule

Complex Usage and sample:
Note: aliasFile parameter in the manager if blank will default to MosModule.ini otherwise will load from the alias File there

# alias~mosmodulecommand=param1,(param2,param3,...)
* You can use alias to predefine your mosmodule command with your default value to override any of the internal default value

* For example:
In mosmodule.ini file:
aid~articleid= %s|introtext|readmore=More\,...|nokkaew|nostate

hello1~phpinc=hello.php,parm1,%s

hello2~phpinc=hello.php,%s,parm2

hello3~phpinc=hello.php|%s,%s

In content:
{mosmodule aid=2}
{mosmodule hello1=parm one in content}
{mosmodule hello2=parm one in content}
{mosmodule hello3=parm one in content,parm two in content}

Further explain:

mosmodule will substitue aid base on the template it found in mosmodule.ini and Will display introtext words of article 2 with read more link "More,..." (escape comma) plus will show the translated article in from Nok Kaew component and bypass state of the article

mosmodule will substitue "hello1" base on the template it found in mosmodule.ini and Will pass "parm one in content" and "parm1" from alias to hello.php

mosmodule will substitue "hello2" base on the template it found in mosmodule.ini and Will pass "parm one in content" and "parm2" from alias to hello.php

mosmodule will substitue "hello3" base on the template it found in mosmodule.ini and Will pass "parm one in content,parm two in content" to hello.php

# ref=id or url
* Displays a reference to a title of an article or a URL

# ref=(articleid or url,(nostate),(readmore=More...)
* Displays a reference to a title of an article or an URL inside another article

* For example:
{mosmodule ref=2,notate}

Further explain: Will display a reference to an article 2 with showing the article title and bypass state.

{mosmodule ref=http://docs.ongetc.com/index.php?q=content/mosmodule}

Further explain: Will display a reference to an URL

# phpinc or inc: Include any script file such as php, javascript, html which will be executed and displays inside an article
* You will need to create a folder called 'mosmodule' in the root directory. Your php scripts will go here. This folder's path can be changed by altering the 'Foldername' parameter in the mosmodule setup
* Assuming your hello.php is in {yourcmsroot}/yourfolder/hello.php then you would put this in your content {mosmodule phpinc=hello.php,firtname,lastname}

* For example:
{mosmodule phpinc=hello.php,firtname,lastname}
{mosmodule inc=hello.js}

# snippet: Execute PHP snippet code inside article from other content that contain PHP code

* For example:
{mosmodule snippet=100}

# module=modulename1,(module2,module3,etc)
* Hard code default to style = -1 (raw)

* For example:
{mosmodule module=Search,poll}

# random=FAQ,(title),(introtext|fulltext|[all])
* Displays the entire section randomly, default to don't show title

* For example:
{mosmodule random=FAQ,title,introtext}

# readmore=2,(introtext|[numberOfWords]),(readmore=More...[Read More...]),(nokkaew|joomfish),(nostate)
* Displays an article inside another article, default is 300 words, readmore with "Read More..." as default text when use with introtext

* For example:
{mosmodule readmore=2,80,readmore=More...,nokkaew,nostate}

Further explain: Will display 80 words of article 2 with read more link "More..." plus will show the translated article in from Nok Kaew component and bypass state of the article

{mosmodule readmore=2,introtext,readmore=More...,nokkaew,nostate}

Further explain: Will display introtext of article 2 with read more link "More..." plus will show the translated article in from Nok Kaew component and bypass state of the article

# articleid=2,(introtext|fulltext|[all]),(readmore=More...[Read More...]),(nokkaew|joomfish),(nostate)
* Displays an article inside another article, default is all, readmore with "Read More..." as default text when use with introtext

* For example:
{mosmodule articleid=2,introtext,readmore=More...,nokkaew,nostate}

Further explain: Will display article 2 only intro text with read more link "More..." plus will show the translated article in from Nok Kaew component

# moscom
* Display MosCom comment link any where in content

* For example:
{mosmodule moscom}

# mosqid=2
* Display your MosQ logic which assume that you already has MosQ logic created in the logic center, please make sure you test in the normal mode before attempt to embed inside your content

* For example:
{mosmodule mosqid=1}

# gigid=2
* Display your gigCalendar inside your article which assume that you already has a GigCalendar ID created in the GigCalendar component

* For example:
{mosmodule gidid=1}

# video: Play embed video from YouTube, Yahoo Video, Google Video or any embed flash video

* For example: Some working sample from YouTube, Yahoo video, and Google video
* YouTube: {mosmodule video=http://www.youtube.com/v/ekcYc3zrJHI}
* Yahoo Video: {mosmodule video=http://us.i1.yimg.com/cosmos.bcst.yahoo.com/player/media/swf/FLVVideoSol...}
* Google Video: {mosmodule video=http://video.google.com/googleplayer.swf?docId=-4897647549985392214&hl=en}

# VideoEgg: VideoEgg Path to your uploaded video file.

* For example: (Some working sample from VideoEgg)
{mosmodule videoegg=/gid328/cid1096/9B/2Q/1171378165tCRacTofc58XDo0sWG5H}

# Flash Video: Play flash (swf or flv) video file in videofolderpath with option width and height.

* For example:
{mosmodule flash=videofolder/flashfile.swf}

# RSS Feed from others sites

* For example:
{mosmodule rssfeed=http://support.ongetc.com/index.php?option=com_rss&feed=RSS2.0&no_html=1}

# Grab Page from others sites.

* For example:
{mosmodule grabpage=http://support.ongetc.com/index2.php}

# Wrapper of url from others sites.

* For example:
{mosmodule wrapper=http://support.ongetc.com/index2.php}
{mosmodule wrapper=http://support.ongetc.com/index2.php,100%,900px,auto,top}
{mosmodule wrapper=http://support.ongetc.com/slideshow.html}

# List article by author
* Displays 5 articles by author using username inside another article, default is 5, all, page
* Pagination in author with customizable mosmodule.css
* Use as Blog by author with pagination in article also works in CB with some hack (ask me)

* For example:
{mosmodule author=administrator,5,introtext,page}

Note:
* add support for itemid in readmore command
* add support for escape comma in parameter like \,
* add support space between comma in parameter

Legacy mambot notes for really old Mambo: (Would not advise to use this!)
* copy {ROOT}/mambots/content/mosmodule.php to {ROOT}/mambots

=== >>>ADVANCE>>> Read this, only if you want to use mosmodule in user module ===

1. User module hack:

* In the includes/frontend.html.php around line 51

Replace this: echo $module->content;

With this:
=== >>> ***** For Mambo 4.6.3+ *****
global $mosConfig_absolute_path;
$mosmodulefunc=$mosConfig_absolute_path."/mambots/content/mosmodule/mosmodule_func.php";
if (file_exists($mosmodulefunc)) { include_once($mosmodulefunc); }
if($isBuffered) {
if (function_exists('mosmodule_bot')) { $module->buffer=mosmodule_bot($module->buffer); }
echo $module->buffer;
} else {
if (function_exists('mosmodule_bot')) { $module->content=mosmodule_bot($module->content); }
echo $module->content;
}

=== >>> ***** For Mambo 4.6.2 or lower *****
global $mosConfig_absolute_path;
$mosmodulefunc=$mosConfig_absolute_path."/mambots/content/mosmodule/mosmodule_func.php";
if (file_exists($mosmodulefunc)) { include_once($mosmodulefunc); }
if (function_exists('mosmodule_bot')) { $module->content=mosmodule_bot($module->content); }

echo $module->content;

or this to allow php code in module

echo eval('?>'.$module->content.'<?php ');

2. Category/Section decription hack:

* In the component/con_content/content.html.php around line 58

Replace:
echo $title->description;

With this:

global $mosConfig_absolute_path;
$mosmodulefunc=$mosConfig_absolute_path."/mambots/content/mosmodule/mosmodule_func.php";
if (file_exists($mosmodulefunc)) { include_once($mosmodulefunc); }
if (function_exists('mosmodule_bot')) { $title->description=mosmodule_bot($title->description); }
echo $title->description;

Other hack and use similar technique like above:
* CB:_getViewTabContents
* YANC:render_content

=== >>>ADVANCE>>> Read this, only if you want to use mosmodule in user module ===