Body

Body – Adding content

Description

After creating the page and setting headers, you want to add actual content to the page. The method in charge is addBodyContent().

By default, if content already exists, the new content is appended. If you wish to overwrite whatever is in the body, use setBody(); unsetBody() completely empties the body without inserting new content. You can also use prependBodyContent() to prepend content to whatever is currently in the array of body elements.

The following constants are defined to be passed as the flag attribute: HTML_PAGE2_APPEND, HTML_PAGE2_PREPEND and HTML_PAGE2_REPLACE. Their usage should be quite clear from their names.

<?php
$page
->addBodyContent('<h1>Hello!</h1>');
$page->addBodyContent('<p>This is a paragraph.</p>');
?>
Setting title and other meta data (Previous) Finishing the page (Next)
Last updated: Tue, 21 Oct 2014 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report or add a note.
View this page in:

User Notes:

There are no user contributed notes for this page.