Libraries: Master

Aus CodeCoupler Wiki
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 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>.

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 will provide the following components:

  • jQuery
  • jQuery-UI
  • IE9.js


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