Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Output.php
Go to the documentation of this file.
1 <?php
27 #require_once 'Zend/Cache/Core.php';
28 
29 
37 {
38 
39  private $_idStack = array();
40 
47  public function __construct(array $options = array())
48  {
49  parent::__construct($options);
50  $this->_idStack = array();
51  }
52 
61  public function start($id, $doNotTestCacheValidity = false, $echoData = true)
62  {
63  $data = $this->load($id, $doNotTestCacheValidity);
64  if ($data !== false) {
65  if ( $echoData ) {
66  echo($data);
67  return true;
68  } else {
69  return $data;
70  }
71  }
72  ob_start();
73  ob_implicit_flush(false);
74  $this->_idStack[] = $id;
75  return false;
76  }
77 
88  public function end($tags = array(), $specificLifetime = false, $forcedDatas = null, $echoData = true, $priority = 8)
89  {
90  if ($forcedDatas === null) {
91  $data = ob_get_clean();
92  } else {
93  $data =& $forcedDatas;
94  }
95  $id = array_pop($this->_idStack);
96  if ($id === null) {
97  Zend_Cache::throwException('use of end() without a start()');
98  }
99  $this->save($data, $id, $tags, $specificLifetime, $priority);
100  if ($echoData) {
101  echo($data);
102  }
103  }
104 
105 }
__construct(array $options=array())
Definition: Output.php:47
$id
Definition: fieldset.phtml:14
save($data, $id=null, $tags=array(), $specificLifetime=false, $priority=8)
Definition: Core.php:348
start($id, $doNotTestCacheValidity=false, $echoData=true)
Definition: Output.php:61
static throwException($msg, Exception $e=null)
Definition: Cache.php:205
end($tags=array(), $specificLifetime=false, $forcedDatas=null, $echoData=true, $priority=8)
Definition: Output.php:88
load($id, $doNotTestCacheValidity=false, $doNotUnserialize=false)
Definition: Core.php:296