Creation (Previous) (Next) Body

View this page in Last updated: Mon, 02 Jul 2007
English | French | German | Hungarian | Japanese | Polish | Spanish | Plain HTML

Headers

Headers -- Setting title and other meta data

Setting headers

The method you surely will use is setTitle() that sets the title of the page; the one that your browser displays in its title/window bar.


<?php
$page->setTitle('My first HTML page');
?>

Meta tags can be set with setMetaData() which takes two parameters, the tag name and the content.


<?php
$page->setMetaData('author', 'Christian Weiske');
?>

A link to a bookmark icon (favicon) can be set using addFavicon() .

Links to related pages (previous, next, home etc.) are added with addHeadLink() - the first parameter determines the URL, the second the relation.


<?php
$page->addHeadLink('home.htm', 'Start');
?>

Adding CSS - Cascading stylesheets

A HTML page may contain two types of stylesheets: Inline css and a link to external .css file.

Inline CSS declarations are made with addStyleDeclaration()


<?php
$page->addStyleDeclaration('
div.block {
    border: 1px solid #000;
}
');
?>

Links to external CSS files are created by using addStyleSheet(). The optional third parameter determines which media type the stylesheet shall be used for.


<?php
$page->addStyleSheet('css/dark.css');
$page->addStyleSheet('css/print.css', 'text/css', 'print');
?>

Adding scripts

You may want to add some javascript code to your page; either inline or link to an external .js file.

Inline code blocks are added with addScriptDeclaration() . The optional second parameter defaults to text/javascript but can be changed as needed.


<?php
$page->addScriptDeclaration('
function javaScriptTest() {
    alert("Test");
}
');
?>

Links to external script files are created by using addScript().


<?php
$page->addScript('js/functions.js');
?>

Creation (Previous) (Next) Body

Download Documentation Last updated: Mon, 02 Jul 2007
Do you think that something on this page is wrong? Please file a bug report or add a note.
User Notes:
There are no user contributed notes for this page.