API15

JCacheOutput/start: Difference between revisions

From Joomla! Documentation

m removing red link to edit, no existant pages
m preparing for archive only
 
Line 61: Line 61:


===Examples===
===Examples===
<CodeExamplesForm />
=== Code Examples ===
<dpl>
<dpl>
  noresultsheader=\n
  noresultsheader=\n
  category=start
  category=start
  category=JCacheOutput
  category=JCacheOutput
  category=CodeExample
  namespace=CodeExample
  category=MethodExample
  category=MethodExample
  include=*
  include=*

Latest revision as of 00:21, 25 March 2017

Description

Start the cache

[<! removed edit link to red link >]

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

Syntax

start($id, $group=null)
Parameter Name Default Value Description
$id $id The cache data id
$group null $group The cache data group

Returns

boolean True if the cache is hit (false else)

Defined in

libraries/joomla/cache/handler/output.php

Importing

jimport( 'joomla.cache.handler.output' );

Source Body

function start( $id, $group=null)
{
        // If we have data in cache use that...
        $data = $this->get($id, $group);
        if ($data !== false) {
                echo $data;
                return true;
        } else {
                // Nothing in cache... lets start the output buffer and start collecting data for next time.
                ob_start();
                ob_implicit_flush( false );
                // Set id and group placeholders
                $this->_id              = $id;
                $this->_group   = $group;
                return false;
        }
}

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

Examples

Code Examples