yii\base\View::renderDynamic PHP 메소드

renderDynamic() 공개 메소드

This method is mainly used together with content caching (fragment caching and page caching) when some portions of the content (called *dynamic content*) should not be cached. The dynamic content must be returned by some PHP statements.
public renderDynamic ( string $statements ) : string
$statements string the PHP statements for generating the dynamic content.
리턴 string the placeholder of the dynamic content, or the dynamic content if there is no active content cache currently.
    public function renderDynamic($statements)
    {
        if (!empty($this->cacheStack)) {
            $n = count($this->dynamicPlaceholders);
            $placeholder = "<![CDATA[YII-DYNAMIC-{$n}]]>";
            $this->addDynamicPlaceholder($placeholder, $statements);
            return $placeholder;
        } else {
            return $this->evaluateDynamicContent($statements);
        }
    }