Libraries: Master

Aus CodeCoupler Wiki
Version vom 24. August 2012, 20:40 Uhr von Tm (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „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 l…“)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Zur Navigation springen Zur Suche springen

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 static content into the master template. In the folder application/views/master you will find the following files:

'head.php: Content will loaded inwith the <head> bodystart.php

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