mosLoadComponent

Last reviewed: 18 Nov 2005, Joomla 1.0.3
phpDocumentor

mosLoadComponent

Loads (executes) the specified component.

This function loads the specified component by including the file in the component's directory bearing the name of the component with the extension .php.

This function does not return a value. The file is included with 'include', and not 'require'. Therefore, if the file is not found, a warning will be generated, but Joomla will continue to execute.

The specified component will be loaded. Before including the file for the component, the $database and $mainframe global variables are declared so that they will be in scope within the component being loaded.

Syntax

void mosLoadComponent ( string $name )

$name
is a string containing the name of the component to load. This component should exist in the directory /components/com_$name and there should be a file called $name.php in this directory.

Defined in

includes/template.php
(includes/frontend.php prior to Joomla 1.1)

Examples

Example: Loading the newsfeeds component

mosLoadComponent( 'newsfeeds' );

This will load the newsfeeds component. More specifically, it will include the file /components/com_newsfeeds/newsfeeds.php.


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

Last Updated ( Tuesday, 03 January 2006 )