Actions

API15

JModuleHelper/getModules

From Joomla! Documentation

< API15:JModuleHelper
Revision as of 17:09, 22 March 2010 by Doxiki (Talk | contribs)

Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Get modules by position

[Edit Descripton]

Description:JModuleHelper/getModules

Syntax

& 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

function &getModules($position)
{
        $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(JRequest::getBool('tp')) {
                        $result[0] = JModuleHelper::getModule( 'mod_'.$position );
                        $result[0]->title = $position;
                        $result[0]->content = $position;
                        $result[0]->position = $position;
                }
        }
 
        return $result;
}

[Edit See Also] SeeAlso:JModuleHelper/getModules

Examples

<CodeExamplesForm />