php - Yii2 Set page title from component view -


i have page, example, /about.

in page's view may set page title: $this->title = "abc" - works ok.

also have header component in /components own view /components/views/header.php

how change page title component's view? $this->title not work because i'm in component's view, not page.

not sure how calling component, change title need specify want change current view.

here example, in view add (or use method used make sure insert view parameter):

mycomponent::changetitle($this); 

and in component (whatever method want this):

public static function changetitle($view) {     $view->title = 'changed'; } 

if not related situation, please add example of view , component can understand better scenario.


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -