Libraries: Master: Components Overview
Components are sets of content for the <head> and/or <body> section, that can be enabled or disabled by config or by code. Components can depend on each other. Enabling one component will enable all depending components, too. Disabling a component, will disable all other depending components, if not used otherwise.
Components will always be included before other components depends on it. Also a component can be configured to be included always after another component.
Default Configuration
The goal of the default configuration of components was to have a html5-ready, cross-browser (and lagacy-browser) compatible quick-start boilerplate. To this purpose, several libraries are enabled by default.
Normalized CSS
The libraries "YAML", "Normalize.css", "HTML5 Boilerplate" have each own normalizing parts. Each of this normalize some style, that other do not. For this reason all of this libraries was used. The normalizers will be used in the following order:
- normalize.css
- main.css from HTML5 Boilerplate
- base.css from YAML
Normalized Typographie CSS
By default CodeCoupler the following components are enabled:
Components Configuration
Components can be configured in application/config/master.php. Every component will be described in one array with three keys:
- enabled: If TRUE the component will be enabled by default.
- config: This value ist component specific. Please read the chapter Components: Overview.
- depends: Thia array tells the framework on what components this one depends. Normally you do not have to modify this.
Enable/Disable Components Dynamicaly
Everywhere in your code you can enable or disable components. You do not have to worry about enabling depending components or the order of the components. Use the following function to handle components:
- $this->master->enable_component($key): Enable component. Use the key of the component.
- $this->master->disable_component($key): Enable component. Use the key of the component.
- $this->master->is_component_enabled($key): Returns TRUE if the component is enabled, otherwise FALSE. Use the key of the component.
You can find an overview of all components, their keys and how to add you own components here: Components: Overview
Development
- Use always <?= base_url ?>. The url-helper is autoloaded.