API16

JModuleHelper/getModules

< API16:JModuleHelper

The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description

Get modules by position



Syntax

static& getModules($position)
Parameter Name Default Value Description
$position $position The position of the module

Returns

array An array of module objects

Defined in

libraries/joomla/application/module/helper.php

Importing

jimport( 'joomla.application.module.helper' );

Source Body

public static function &getModules($position)
{
        $app            = &JFactory::getApplication();
        $position       = strtolower($position);
        $result         = array();

        $modules = &JModuleHelper::_load();

        $total = count($modules);
        for ($i = 0; $i < $total; $i++)
        {
                if ($modules[$i]->position == $position) {
                        $result[] = &$modules[$i];
                }
        }
        if (count($result) == 0)
        {
                if ($app->getCfg('debug_modules') && JRequest::getBool('tp'))
                {
                        $result[0] = JModuleHelper::getModule('mod_'.$position);
                        $result[0]->title = $position;
                        $result[0]->content = $position;
                        $result[0]->position = $position;
                }
        }

        return $result;
}



Examples

Code Examples


Advertisement