UWAGA: Strona zawiera materiały archiwalne. Większość artykułów dotyczy Joomla! 1.0
Start arrow Programowanie arrow API arrow 11. Interfejs API
11. Interfejs API Drukuj Email

11. Interfejs API

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.

Składnia

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)

Przykłady

Przykład: 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.

Zmieniony ( 05.02.2006. )
 
następny artykuł »