CHAPTER IV



API — Creating a component

Add the component to the list in components.xml, located at the root of the components directory:

Interfaces for implementing components

New component

https://github.com/borjaabad/cms.um

The global $components variable makes this file’s contents available anywhere in the code.

Constants defined by the framework’s Component.php class when a component is loaded, and available throughout the application:

NAME_COM name defined in components.xml (required)

ROOT_COM               Physical path to the component’s root directory

DISPLAYNAME_COM displayName defined in components.xml

MENU_COM menu defined in components.xml

SQLPREFIX_COM sqlprefix defined in components.xml

ENABLED_COM enabled defined in components.xml

Each component has the following default directory structure:

ROOT.DS.'components'.DS.'component'.DS.'controllers'
ROOT.DS.'components'.DS.'component'.DS.'models'
ROOT.DS.'components'.DS.'component'.DS.'views'
ROOT.DS.'components'.DS.'component'.DS.'public'

To protect a component using sessions:

Session::control();

Call this in the constructors of the component’s controllers.

If the user is not logged in, return to BASE_URL.





CMS UM header