Difference between revisions of "JResponse/allowCache"
From Joomla! Documentation
< API15:JResponse
m (removing red link to edit, no existant pages) |
m (preparing for archive only) |
||
Line 47: | Line 47: | ||
===Examples=== | ===Examples=== | ||
− | + | === Code Examples === | |
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=allowCache | category=allowCache | ||
category=JResponse | category=JResponse | ||
− | + | namespace=CodeExample | |
category=MethodExample | category=MethodExample | ||
include=* | include=* |
Latest revision as of 20:05, 24 March 2017
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]
Set/get cachable state for the response
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax[edit]
allowCache($allow=null)
Parameter Name | Default Value | Description |
---|---|---|
$allow | null | $allow |
Returns[edit]
boolean True of browser caching should be allowed
Defined in[edit]
libraries/joomla/environment/response.php
Importing[edit]
jimport( 'joomla.environment.response' );
Source Body[edit]
function allowCache($allow = null)
{
if (!is_null($allow)) {
$GLOBALS['_JRESPONSE']->cachable = (bool) $allow;
}
return $GLOBALS['_JRESPONSE']->cachable;
}
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
From: http://groups.google.com/group/joomla-dev-general/browse_thread/thread/6ef5fe7eba4efc26
How can I override the default joomla headers from within a custom component? I would like to change
to
JResponse::allowCache(true) did the trick. If it helps anyone else, here is the code that worked for me.