Skip to main content
Home
Blog

Main navigation

  • Home
User account menu
  • Log in

Breadcrumb

  1. Home
  2. MosModule FAQ

MosModule: Show MosCom latest 5?

By ongetc , 10 October, 2009

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 ";
$database->setQuery($qry);
$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: http://support.ongetc.com/index.php?option=com_content&task=view&id=227…

Book traversal links for MosModule FAQ

  • MosModule: How to use snippet?
  • Up
  • MosModule: Show content in a module
  • Printer-friendly version

Reseller hosting (free)

Hosting24 (w/ ssh)

A2 Hosting

Monthly archive

  • September 2009 (14)
  • October 2009 (11)
  • January 2010 (2)
  • June 2010 (3)
  • October 2011 (1)
  • March 2012 (1)
  • July 2012 (1)
  • February 2017 (564)
  • March 2017 (5)
  • April 2017 (2)

Pagination

  • 1
  • Next page

Popular content

Last viewed:

  • Wiki Type FrameWork
  • The Regex Coach
  • Contenido
  • Simple Machines Forum
  • Apache OFBiz®
  • DotNetNuke
  • NPDS
  • Exponent
  • How to install PHP on Windows 2008
  • How to use Drupal multiple sites feature?

User login

  • Reset your password