ViewBlock implements the concept of Blocks or Slots in the View layer. Slots or blocks are combined with extending views and layouts to afford slots of content that are present in a layout or parent view, but are defined by the child view or elements used in the view.
string
'append' string
'prepend' $_active protected array$_blocks protected array$_discardActiveBufferOnEnd protected booleanAppend to an existing or new block. Appending to a new block will create the block.
Concat content to an existing or new block. Concating to a new block will create the block.
Set the content for a block. This will overwrite any existing content.
active( )
Get the name of the currently open block.
append( string $name , string $value null )
Append to an existing or new block. Appending to a new block will create the block.
Calling append() without a value will create a new capturing block that needs to be finished with View::end(). The content of the new capturing context will be added to the existing block context.
$name $value optional null concat( string $name , mixed $value null , string $mode ViewBlock::APPEND )
Concat content to an existing or new block. Concating to a new block will create the block.
Calling concat() without a value will create a new capturing block that needs to be finished with View::end(). The content of the new capturing context will be added to the existing block context.
$name $value optional null $mode optional ViewBlock::APPEND If ViewBlock::APPEND content will be appended to existing content. If ViewBlock::PREPEND it will be prepended.
end( )
End a capturing block. The compliment to ViewBlock::start()
exists( string $name )
Check if a block exists
$name get( string $name , string $default '' )
Get the content for a block.
$name $default optional '' keys( )
Get the names of all the existing blocks.
set( string $name , mixed $value )
Set the content for a block. This will overwrite any existing content.
$name $value start( string $name )
Start capturing output for a 'block'
Blocks allow you to create slots or blocks of dynamic content in the layout. view files can implement some or all of a layout's slots.
You can end capturing blocks using View::end(). Blocks can be output using View::get();
$name CakeExceptionstartIfEmpty( string $name )
Start capturing output for a 'block' if it is empty
Blocks allow you to create slots or blocks of dynamic content in the layout. view files can implement some or all of a layout's slots.
You can end capturing blocks using View::end(). Blocks can be output using View::get();
$name unclosed( )
Get the names of the unclosed/active blocks.
protected boolean
Should the currently captured content be discarded on ViewBlock::end()
false
© 2005–2016 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
http://api.cakephp.org/2.8/class-ViewBlock.html