/** * Append to an existing or new block. * * Appending to a new block will create the block. * * @param string $name Name of the block * @param mixed $value The content for the block. * @return void * @see ViewBlock::concat() */ public function append($name, $value = null) { if ($value !== null) { $this->Blocks->concat($name, $value); return; } $this->Blocks->start($name); echo $this->Blocks->get($name); }
/** * Start capturing output for a 'block' * * You can use start on a block multiple times to * append or prepend content in a capture mode. * * ``` * // Append content to an existing block. * $this->start('content'); * echo $this->fetch('content'); * echo 'Some new content'; * $this->end(); * * // Prepend content to an existing block * $this->start('content'); * echo 'Some new content'; * echo $this->fetch('content'); * $this->end(); * ``` * * @param string $name The name of the block to capture for. * @return void * @see ViewBlock::start() */ public function start($name) { $this->Blocks->start($name); }