Closed starrychloe closed 9 years ago
This is because the compiled code is executed inside the function so you need to use $view instead of a $this.
That worked! Awesome!
How I got a raw HAML page/layout to work:
-use app\assets\AppAsset;
-AppAsset::register($view);
-$view->off(\yii\web\View::EVENT_END_BODY, [\yii\debug\Module::getInstance(), 'renderToolbar']);
-$view->beginPage()
!!! 5
%html
%head
-$view->head()
%body
%style
*{margin:0px;}
.star-rating{:title => $rating, 'data-url' => $model->url}
*****
-$view->endBody()
-$view->endPage()
Yoohoo, it's me again... thanks for the fix for the other problem. Here's another. There's no way to use HAML on the layout or to render a sub page, as $this is unavailable. I tried the following, copying from the default
views/layouts/main.php
.PHP Fatal Error – yii\base\ErrorException: Using $this when not in object context
Line 10 is highlighted in red.