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
Post a Comment