I am a complete novice with Yii2, but have decades of programming in other languages. I have bought "Yii2 By Example" by Fabrizio Caldarelli, and installed a vanilla basic Yii2 system, so I am on 2.0.12 with PHP 7.1.1 running locally on Win 10 Pro. I have got to chapter 2, which is the first use of a view in a "news" controller. There is a corresponding action funtion
localhost/basic/web/index.php?r=news/items-list
…
public function actionItemsList()
{
$newsList = [
[ 'title' => 'First World War', 'date' => '1914-07-28' ],
[ 'title' => 'Second World War', 'date' => '1939-09-01' ],
[ 'title' => 'First man on the moon', 'date' => '1969-07-20' ]
];
// return $this->render(‘itemsList’,[‘newsList’ => $newsList]);
return $this->render('@app/views/news/itemsList.php',['newsList' => $newsList]);
}
I have tried various flavours of the commented out line, but they always throw up this error
PHP Notice – yii\base\ErrorException
Use of undefined constant ‘itemsList’ - assumed ‘‘itemsList’’
However the one with the full path works fine. I have not changed any of the config of the installaion, but it seems something else is missing.
Can anyone help please?
Thanks