-
Notifications
You must be signed in to change notification settings - Fork 0
Page
loranger edited this page Sep 13, 2010
·
6 revisions
Page is the main tao container and renderer.
This singleton allows you to create any webpage depending on the DTD you want to use :
Page('xhtml');
Page('xhtml 1.1');
Page('xhtml 1.0 transitional');
Page('html 3.1');
Page('xhtml 1.0 strict');
Page('html 5');
or even empty (this will output xhtml 1.0 transitional)
Page();
As simple as this :
Page()->addContent('Hello world!');
addTo
method.
-
setTitle( string $title )
Set the title of the current page or replace it.
-
setBase( string $uri [, string $target] )
Set the base uri of the current page or replace it.
-
addMeta( string $name, string $content, string $type = 'name')
Add a meta tag to the current page or replace an existing one.
-
addHTTPMeta( string $name, string $content)
Add a http-equiv meta tag to the current page or replace an existing one.
-
addCSS( mixed $url )
Add a css link inside the head part of the current Page.
-
addStyle( string $css_code [, string $media] )
Append an inline style definition for a specified media (or create it if not exists).
-
addScriptSrc( string $url [, string $position = 'bottom'] )
Add a javascript src to the current Page.
The default position is bottom and the script will be added at the bottom of the page, even if this method is called at the begin.
But position can also be top or head (inside the head part of the document), bottom (default), body or false (excatly where the method is called).
-
addContent( mixed $content )
Add content to the current page. Content can be string, array or tao object.
-
render()
Internal method called to render the page. You never (or never have to) call it directly, but you can add this method in your custom Page object to hook the Page rendering and adding extra content or extra manipulations just before the Page display. In that case, whatever you do in this render method, you have to return its parent renderingreturn parent::render();
at the very end.