Hope to add template function with "block"

like django

<<<

{% block header %}

placeholder

{% endbock %}

>>>

in qeephp

<<<

<?php $this->_block(‘header’); ?>

placeholder

<?php $this->_endblock(); ?>

is very useful~!~~!

you mean this?

in layout:

<?php echo $this->clips[‘left01’]; ?>

in view:

<?php $this->beginClip(‘left01’); ?>

&lt;?php &#036;this-&gt;widget('HomeMenu', array('visible'=&gt;true)); ?&gt;

<?php $this->endClip(); ?>


class PBlock extends CWidget

{

    public $blockName = null;

    public $isLayout = false;

    private static $_blocks = array();

    

	public function init()

	{

		ob_start();

		ob_implicit_flush(false);

	}


	public function run()

	{

	    $output = ob_get_clean();

		if (!isset(self::$_blocks[$this->blockName])) {

            self::$_blocks[$this->blockName] = $output;

		}

        if ($this->isLayout) {

            echo self::$_blocks[$this->blockName];

        }

	}

}

in layout:


<?php $this->beginWidget('PBlock', array('blockName' => 'test', 'isLayout' => true));?>

in layout

<?php $this->endWidget();?>

in view:


<?php $this->beginWidget('PBlock', array('blockName' => 'test'));?>

in view

<?php $this->endWidget();?>

Thank you! this way is ok~, but if i use block functioin~like:

<?php $this->block(‘title’); ?> Home page <?php $this->endBlock(); ?> – in layouts/main.php

and in my view file:

index.php >>>

unused in this file

show.php >>>

<?php $this->block(‘title’); ?> Show now <?php $this->endBlock(); ?>

when i render above tow view files, get the title:

index.php >>>

Home Page

show.php >>>

Show now

my mean is , block function have "default", or overwrite, evan append

This is good way to replace block function~

but, in my opinion, use block in layout file, is the best way~

You can use $this->beginClip(‘test’, array(‘renderClip’=>true))