Skip to content

Commit

Permalink
Update views.rst
Browse files Browse the repository at this point in the history
Added an example of modified contents
  • Loading branch information
yosus authored Oct 22, 2024
1 parent 96b2354 commit f86c63a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions en/views.rst
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,17 @@ title, and sometimes assign the title as a view variable in the controller::
// In view file or layout above $this->fetch('title')
$this->assign('title', $title);

// Example where block contents are modified
$this->start('test_view_block');
echo 'default contents';
$this->end();
// Output : default contents
echo $this->fetch('test_view_block');
$this->assign('test_view_block', 'modified contents');
// Output : modified contents
echo $this->fetch('test_view_block');


The ``prepend()`` method allows you to prepend content to an existing block::

// Prepend to sidebar
Expand Down

0 comments on commit f86c63a

Please sign in to comment.