mosCountModules

Last reviewed: 18 Nov 2005, Joomla 1.0.3
phpDocumentor

mosCountModules

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.

Syntax

int mosCountModules ( [ string $position ] )

$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/template.php
(includes/frontend.php prior to Joomla 1.1)

Examples

Example: Counting the modules in the left position.

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

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 )