API15

Difference between revisions of "JResponse/toString"

From Joomla! Documentation

< API15:JResponse
(New page: ===Description=== Sends all headers prior to returning the string <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>[[Description:JResponse/toString|Edit Descripton]...)
 
m (removing red link to edit, no existant pages)
Line 3: Line 3:
  
 
<span class="editsection" style="font-size:76%;">
 
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JResponse/toString|Edit Descripton]]<nowiki>]</nowiki>
+
<nowiki>[<! removed edit link to red link >]</nowiki>
 
</span>
 
</span>
  
{{Description:JResponse/toString}}
+
<! removed transcluded page call, red link never existed >
  
 
===Syntax===
 
===Syntax===
Line 55: Line 55:
  
 
<span class="editsection" style="font-size:76%;">
 
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[SeeAlso:JResponse/toString|Edit See Also]]<nowiki>]</nowiki>
+
<nowiki>[<! removed edit link to red link >]</nowiki>
 
</span>
 
</span>
{{SeeAlso:JResponse/toString}}
+
<! removed transcluded page call, red link never existed >
  
 
===Examples===
 
===Examples===
Line 70: Line 70:
 
  format= ,,,
 
  format= ,,,
 
</dpl>
 
</dpl>
 +
[[Category:Archived pages API15]]

Revision as of 13:45, 12 May 2013

The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description[edit]

Sends all headers prior to returning the string

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax[edit]

toString($compress=false)
Parameter Name Default Value Description
$compress false $compress If true, compress the data

Returns[edit]

string

Defined in[edit]

libraries/joomla/environment/response.php

Importing[edit]

jimport( 'joomla.environment.response' );

Source Body[edit]

function toString($compress = false)
{
        $data = JResponse::getBody();

        // Don't compress something if the server is going todo it anyway. Waste of time.
        if($compress && !ini_get('zlib.output_compression') && ini_get('output_handler')!='ob_gzhandler') {
                $data = JResponse::_compress($data);
        }

        if (JResponse::allowCache() === false)
        {
                JResponse::setHeader( 'Expires', 'Mon, 1 Jan 2001 00:00:00 GMT', true );                                // Expires in the past
                JResponse::setHeader( 'Last-Modified', gmdate("D, d M Y H:i:s") . ' GMT', true );               // Always modified
                JResponse::setHeader( 'Cache-Control', 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0', false );
                JResponse::setHeader( 'Pragma', 'no-cache' );                                                                                   // HTTP 1.0
        }

        JResponse::sendHeaders();
        return $data;
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples[edit]

<CodeExamplesForm />