|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <?php
-
-
-
- namespace common\components ;
-
- class MyView extends \yii\web\View
- {
- var $title ;
- var $page_title ;
- var $buttons ;
-
- public function setTitle($title, $page_title = '')
- {
- $this->title = $title ;
- if(strlen($page_title)) {
- $this->page_title = $page_title ;
- }
- else {
- $this->page_title = $title ;
- }
- }
-
- public function getTitle()
- {
- return $this->title ;
- }
-
- public function setPageTitle($page_title)
- {
- $this->page_title = $page_title ;
- }
-
- public function getPageTitle()
- {
- return $this->page_title ;
- }
-
- public function getControllerAction()
- {
- return Yii::$app->controller->id.'/'.Yii::$app->controller->action->id ;
- }
-
- public function addBreadcrumb($breadcrumb)
- {
- $this->params['breadcrumbs'][] = $breadcrumb ;
- }
-
- public function addButton($button)
- {
- $this->buttons[] = $button ;
- }
-
- public function setMeta($name, $content)
- {
- Yii::$app->view->registerMetaTag([
- 'name' => $name,
- 'content' => $content
- ]);
- }
- }
|