view - render only works with full path

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


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?


The “single quotes” aren’t single quotes.

sometimes operating systems behave weird with camel case paths, I would recommend go lowercase with dashes or underscores. that could be the problem try change it to lowercase filenames.

Well spotted. It is somewhat unfortunate that this code snippet came from the source download for the book!

Thanks for your help