Comunitatea PHP Romania
 

 
Headers

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()

$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');
?>

Ultimele discutii in forum RSS Forum

Ultimele articole Ultimele articole

Top membri

Pirahna Pirahna
la birou
carco carco
Bucuresti
Birkoff Birkoff
Bucuresti
mihaitha mihaitha
Sibiu
Mascka Mascka
Braila
gabysolomon gabysolomon
Bacau
whooper whooper
Toronto ON
raul_ raul_
dechim dechim
Drobeta Turnu Severin
Amenthes Amenthes

Newsletter


Email:
 inscriere
 renuntare
 
 Arhiva newsletter

Parteneriat

Copyright © 2001-2008 PHP Romania Add PHPRomania to Google Add PHPRomania to Del.icio.us Add PHPRomania to Stumbleupon Add PHPRomania to Yahoo! Add PHPRomania to Digg Add PHPRomania to Blink Proxy | Problem Mortgage | Loans | Loans | Credit Card Consolidation
Ads: Partener Way2Web Nework: gazduire web | inregistrare domenii | web design | imobiliare | web hosting
Powered by Simplis