Basic view access question...

Really basic new user confusion.

On a local machine I load yii_playground/index-test.php?r=site and everything is good.

I copy yii_playground/protected/controllers/SiteController.php to TestController.php and change the class name, then load yii_playground/index-test.php?r=test and get the following error:

TestController cannot find the requested view "index".

Why is that? Haven’t changed anything with regards to the view; should load the same way, no?

Thanks.

In your view directory you have a folder named "site" where you can find all the view attached to the controller "site" (contact, index, error, …).

Now that you have a controller named "Test", you should create in "view" a folder named "test" and put in it all the view that you need.

For your example you should put the index.php file from "view/site" to "view/test" to display the index page.

So, do you have protected/views/layouts/test/index.php ?

<edit>

Too late! :)

Argh! Thank you for the kind nudge, and apologies for the brain fart…