web/UniView.php
public function stopBlock($name = null)
    {
        if (empty($this->currentBlockName)) {
            throw new InvalidParamException(
                "Unexpected stopBlock in '{$this->processingViewFile}'"
            );
        }
        if (!empty($name) && $this->currentBlockName != $name) {
            throw new InvalidParamException(
                "Expected current closed block name '{$this->currentBlockName}' instead of '{$name}'"
              . " in '{$this->processingViewFile}'"
            );
        }
        $name = $this->currentBlockName;

        $fullBlockName = $this->getCurrentBlockFullName();

        array_pop(static::$_blocksStack);

        $content = ob_get_clean();

        // save every block of every view-file in inherit chain (not only for last) - it will need for render parentBlock
        if (!$this->viewBlocks($this->processingViewFile)->exists($fullBlockName)) {
            $this->viewBlocks($this->processingViewFile)->add($fullBlockName, $content);
        }

        $savedContent = $this->findProperBlock($fullBlockName, $this->processingViewFile);
        if ($savedContent !== false) {
            $content = $savedContent; // rewrite
        }
        if ($savedContent !== false && empty($this->_extendingParent[$this->processingViewFile])) {
            // such block already saved - replace block in parent view-template by saved content
            $n = $this->hasParentBlock($savedContent);
            while ($n--) {
                $savedContent = $this->replaceParentBlock($savedContent);
            }
            echo $savedContent;
        } else {
            echo $content; // always echo - to catch by outer block
        }
    }
public function stopBlock($name = null)
    {
        if (empty($this->currentBlockName)) {
            throw new InvalidParamException(
                "Unexpected stopBlock in '{$this->processingViewFile}'"
            );
        }
        if (!empty($name) && $this->currentBlockName != $name) {
            throw new InvalidParamException(
                "Expected current closed block name '{$this->currentBlockName}' instead of '{$name}'"
              . " in '{$this->processingViewFile}'"
            );
        }
        $name = $this->currentBlockName;

        $fullBlockName = $this->getCurrentBlockFullName();

        array_pop(static::$_blocksStack);

        $content = ob_get_clean();

        // save every block of every view-file in inherit chain (not only for last) - it will need for render parentBlock
        if (!$this->viewBlocks($this->processingViewFile)->exists($fullBlockName)) {
            $this->viewBlocks($this->processingViewFile)->add($fullBlockName, $content);
        }

        $savedContent = $this->findProperBlock($fullBlockName, $this->processingViewFile);
        if ($savedContent !== false) {
            $content = $savedContent; // rewrite
        }
        if ($savedContent !== false && empty($this->_extendingParent[$this->processingViewFile])) {
            // such block already saved - replace block in parent view-template by saved content
            $n = $this->hasParentBlock($savedContent);
            while ($n--) {
                $savedContent = $this->replaceParentBlock($savedContent);
            }
            echo $savedContent;
        } else {
            echo $content; // always echo - to catch by outer block
        }
    }
public function stopBlock ( $ name = null ) { if ( empty ( $ this -> currentBlockName ) ) { throw new InvalidParamException ( "Unexpected stopBlock in '{$this->processingViewFile}'" ) ; } if ( ! empty ( $ name ) && $ this -> currentBlockName != $ name ) { throw new InvalidParamException ( "Expected current closed block name '{$this->currentBlockName}' instead of '{$name}'" . " in '{$this->processingViewFile}'" ) ; } $ name = $ this -> currentBlockName ; $ fullBlockName = $ this -> getCurrentBlockFullName ( ) ; array_pop ( static :: $ _blocksStack ) ; $ content = ob_get_clean ( ) ; // save every block of every view-file in inherit chain (not only for last) - it will need for render parentBlock if ( ! $ this -> viewBlocks ( $ this -> processingViewFile ) -> exists ( $ fullBlockName ) ) { $ this -> viewBlocks ( $ this -> processingViewFile ) -> add ( $ fullBlockName , $ content ) ; } $ savedContent = $ this -> findProperBlock ( $ fullBlockName , $ this -> processingViewFile ) ; if ( $ savedContent !== false ) { $ content = $ savedContent ; // rewrite } if ( $ savedContent !== false && empty ( $ this -> _extendingParent [ $ this -> processingViewFile ] ) ) { // such block already saved - replace block in parent view-template by saved content $ n = $ this -> hasParentBlock ( $ savedContent ) ; while ( $ n -- ) { $ savedContent = $ this -> replaceParentBlock ( $ savedContent ) ; } echo $ savedContent ; } else { echo $ content ; // always echo - to catch by outer block } }
Stop block with save or echo.
Stop block with save or echo .