Documentation Menu

1.5 Template Project

The Joomla! Documentation Working Group is running a project to develop detailed reference and tutorial material on Joomla! 1.5 templates.  There is a project page on the documentation wiki where you can see the work in progress and help us by contributing your knowledge.

Who's Online

We have 5 guests online

Help Site License

The Joomla! Help Site content is copyright © 2005 - 2008 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution NonCommercial ShareAlike 2.5. Some parts of this website may be subject to other licenses.
Home arrow Manual arrow 11. API Reference arrow mosCountModules

mosCountModules PDF Print E-mail

Last reviewed: 18 Nov 2005, Joomla 1.0.3


Counts the number of module(s) in the specified position.

This function determines the number of modules in a given position. It is used primarily in the front end by the templates for the purpose of layout and styling.

Returns an integer equal to the number of modules in the specified position. The position parameters defaults to 'left'.

This function will return 1 if the GET variable tp is true. The tp variable is used by the Site Preview function in the adminstration backend. If the site is being previewed with positions, then tp is set to 1. Otherwise, tp is set to 0.


int mosCountModules ( [ string $position ] )

is a string containing the position for which to count the modules (e.g. 'top', 'left', 'bottom', 'right', 'user1'). This parameter is optional and if omitted will default to 'left'.

Defined in

(includes/frontend.php prior to Joomla 1.1)


Example: Counting the modules in the left position.

function displayLeftModulesCount() {
    $leftModuleCount = mosCountModules( 'left' );
    echo "There are $leftModuleCount modules in the left position.";

might produce:

There are 2 modules in the left position.

Please report any errors on this page to the Developer Documentation Forum.

Last Updated ( Tuesday, 03 January 2006 )
< Prev   Next >