Hi!
I’m starting to explore Yii2 using the basic template. I started to develop a widget which would render a result view, which would use Bootstrap in “raw” html, but nothing would be displayed on the page.
So I tried to copy the navbar code that comes with the template to my view file, and use the widget in the main layout, and still nothing showed up.
This is part of the main layout file:
<?= MyWidget::widget() ?>
This is the content of MyWidget class:
public function init()
{
parent::init();
}
public function run()
{
$this->render('categories');
}
This is the view file:
<?php
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
NavBar::begin([
'brandLabel' => 'My Company',
'brandUrl' => Yii::$app->homeUrl,
'options' => [
'class' => 'navbar-inverse navbar-fixed-top',
],
]);
NavBar::end();
?>
MyWidget class is located at @app/components, and the associated view file is at @app/components/views.
Can someone see something wrong with this?
Any help would be appreciated