Actions

API16

JResponse/getBody

From Joomla! Documentation

< API16:JResponse
Revision as of 17:46, 22 March 2010 by Doxiki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Return the body content

[Edit Descripton]

Description:JResponse/getBody

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

[Edit See Also] SeeAlso:JResponse/getBody

Examples

<CodeExamplesForm />