PHP 클래스 yii\web\View

View provides a set of methods (e.g. [[render()]]) for rendering purpose. View is configured as an application component in Application by default. You can access that instance via Yii::$app->view. You can modify its configuration by adding an array to your application config under components as it is shown in the following example: ~~~ 'view' => [ 'theme' => 'app\themes\MyTheme', 'renderers' => [ you may add Smarty or Twig renderer here ] ... ] ~~~
부터: 2.0
저자: Qiang Xue ([email protected])
상속: extends yii\base\View
파일 보기 프로젝트 열기: yiisoft/yii2 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$assetBundles list of the registered asset bundles. The keys are the bundle names, and the values are the registered AssetBundle objects.
$css the registered CSS code blocks.
$cssFiles the registered CSS files.
$js the registered JS code blocks
$jsFiles the registered JS files.
$linkTags the registered link tags.
$metaTags the registered meta tags.
$title the page title

공개 메소드들

메소드 설명
beginBody ( ) Marks the beginning of an HTML body section.
clear ( ) Clears up the registered meta tags, link tags, css/js scripts and files.
endBody ( ) Marks the ending of an HTML body section.
endPage ( boolean $ajaxMode = false ) Marks the ending of an HTML page.
getAssetManager ( ) : AssetManager Registers the asset manager being used by this view object.
head ( ) Marks the position of an HTML head section.
registerAssetBundle ( string $name, integer | null $position = null ) : AssetBundle Registers the named asset bundle.
registerCss ( string $css, array $options = [], string $key = null ) Registers a CSS code block.
registerCssFile ( string $url, array $options = [], string $key = null ) Registers a CSS file.
registerJs ( string $js, integer $position = self::POS_READY, string $key = null ) Registers a JS code block.
registerJsFile ( string $url, array $options = [], string $key = null ) Registers a JS file.
registerLinkTag ( array $options, string $key = null ) Registers a link tag.
registerMetaTag ( array $options, string $key = null ) Registers a meta tag.
renderAjax ( string $view, array $params = [], object $context = null ) : string Renders a view in response to an AJAX request.
setAssetManager ( AssetManager $value ) Sets the asset manager.

보호된 메소드들

메소드 설명
registerAssetFiles ( string $name ) Registers all files provided by an asset bundle including depending bundles files.
renderBodyBeginHtml ( ) : string Renders the content to be inserted at the beginning of the body section.
renderBodyEndHtml ( boolean $ajaxMode ) : string Renders the content to be inserted at the end of the body section.
renderHeadHtml ( ) : string Renders the content to be inserted in the head section.

메소드 상세

beginBody() 공개 메소드

Marks the beginning of an HTML body section.
public beginBody ( )

clear() 공개 메소드

Clears up the registered meta tags, link tags, css/js scripts and files.
public clear ( )

endBody() 공개 메소드

Marks the ending of an HTML body section.
public endBody ( )

endPage() 공개 메소드

Marks the ending of an HTML page.
public endPage ( boolean $ajaxMode = false )
$ajaxMode boolean whether the view is rendering in AJAX mode. If true, the JS scripts registered at [[POS_READY]] and [[POS_LOAD]] positions will be rendered at the end of the view like normal scripts.

getAssetManager() 공개 메소드

Registers the asset manager being used by this view object.
public getAssetManager ( ) : AssetManager
리턴 AssetManager the asset manager. Defaults to the "assetManager" application component.

head() 공개 메소드

Marks the position of an HTML head section.
public head ( )

registerAssetBundle() 공개 메소드

All dependent asset bundles will be registered.
public registerAssetBundle ( string $name, integer | null $position = null ) : AssetBundle
$name string the class name of the asset bundle (without the leading backslash)
$position integer | null if set, this forces a minimum position for javascript files. This will adjust depending assets javascript file position or fail if requirement can not be met. If this is null, asset bundles position settings will not be changed. See [[registerJsFile]] for more details on javascript position.
리턴 AssetBundle the registered asset bundle instance

registerAssetFiles() 보호된 메소드

Removes a bundle from [[assetBundles]] once files are registered.
protected registerAssetFiles ( string $name )
$name string name of the bundle to register

registerCss() 공개 메소드

Registers a CSS code block.
public registerCss ( string $css, array $options = [], string $key = null )
$css string the content of the CSS code block to be registered
$options array the HTML attributes for the `