Libraries: Master: Unterschied zwischen den Versionen
Tm (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
Tm (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
||
| Zeile 22: | Zeile 22: | ||
* '''bodyend.php:''' Static content at the end of <body>. | * '''bodyend.php:''' Static content at the end of <body>. | ||
== Components == | == Master Components == | ||
Components are sets of content for the <head> 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 include before other components depends on it. | Components are sets of content for the <head> 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 include before other components depends on it. | ||
By default CodeCoupler | By default CodeCoupler the following components are enabled: | ||
* jQuery | * jQuery | ||
* jQuery-UI | * jQuery-UI | ||
* IE9.js | * IE9.js | ||
* html5shiv | |||
* yaml | |||
=== Components Configuration === | |||
Components can be configured in '''application/config/master_components'''. 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. | |||
== Configuration == | == Configuration == | ||
Version vom 24. August 2012, 23:28 Uhr
In contrast to the basic CodeIgniter framework, every output of a controller will be surrounded by a master-template. The basic layout of the master template looks like this:
<!DOCTYPE ... />
<html ... >
<head>
<charset ... />
<title> ... </title>
</head>
<body>
[YOUR CONTROLLER OUTPUT]
</body>
</html>
Extending Master
You can add own static content into the master template. In the folder application/views/master you will find the following files:
- head.php: Static content for the <head>.
- bodystart.php: Static content at the beginning of <body>.
- bodyend.php: Static content at the end of <body>.
Master Components
Components are sets of content for the <head> 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 include before other components depends on it.
By default CodeCoupler the following components are enabled:
- jQuery
- jQuery-UI
- IE9.js
- html5shiv
- yaml
Components Configuration
Components can be configured in application/config/master_components. 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.
Configuration
Some basic configurations you can do here:
application/config/master.php
The configuration Variables are:
- master_doctype: Defines the HTML-Documenttype. Can be one of the following: xhtml11, xhtml1-strict, xhtml1-trans, xhtml1-frame, html5, html4-strict, html4-trans, and html4-frame. Values are saved in the doctypes config file. Attention! You should leave the doctype to “xhtml1-strict”. The most jQuery addons works only perfectly in this mode.
- master_components: Array of components. Components are in the most cases javascript-libraries. You can enable or disable a component by default if you set the key "enabled" of each to "TRUE". The other keys "config" and "depends" are component-specific configuration
• master_components_options: Array of options for the different components. You can read the details in the particular chapters.
Here is a short overview where you can configure the behaviour of the master-template:
- config/master.php: Set the DOCTYPE and enable JavaScript-Libraries by default.
- language/english/master_lang.php: Set charset, page-language, title. You can set for every language of your application different configurations.
- views/master/head.php: Static content for the <head>.
- views/master/bodystart.php: Static content at the beginning of <body>.
- views/master/bodyend.php: Static content at the end of <body>.
Over and above that you use the functions $this->master->add_head(), $this->master->add_bodystart() and $this->master->add_bodyend() to add dynamically content into the <head> and <body> form everywhere in your application.
Read the full documentation of the master-template library here: Libraries: Master