API16

API16:JResponse/getBody

From Joomla! Documentation

Description

Return the body content



Syntax

static getBody($toArray=false)
Parameter Name Default Value Description
$toArray false $toArray Whether or not to return the body content as an array of strings or as a single string; defaults to false

Returns

string|array

Defined in

libraries/joomla/environment/response.php

Importing

jimport( 'joomla.environment.response' );

Source Body

public static function getBody($toArray = false)
{
        if ($toArray) {
                return $GLOBALS['_JRESPONSE']->body;
        }

        ob_start();
        foreach ($GLOBALS['_JRESPONSE']->body as $content) {
                echo $content;
        }
        return ob_get_clean();
}



Examples

Code Examples