I just read about the advanced action technique in the documentation.
So I created a test file call TestAction.php under /protected/controllers/test/TestAction.php
And in the controller ‘TestController.php’ under /protected/controllers/ I inserted
class TestController extends Controller
public function actions()
The TestAction.php file looks like:
class TestAction extends CAction
public function run()
If I call this action using index.php?r=test/test in the browser, I get the following error message:
Any thoughts on what I could be missing here?
check that you have protected/controllers/test/TestAction.php
If the file is there… check for proper case of the file ie. TestAction.php… and the file and parent folder permissions
Thanks mdomba. It was indeed a problem with the folder’s permissions. Now it is working just fine
Now, how could I combine these two things:
With the help of this topic I created a method in my controller.
With mdomba’s help I managed to put the actions, which I used to have in my controller, into a file in a new folder.
Since the method still remains inside the controller what would be the appropriate way to call this method from inside the actions which is in the new folder? I believe $this is not an option anymore.
I would try $this->controller.
I tried $this->TestController->getSiteModel(); but had no luck.
However, if I use TestController::getSiteModel(); it works.
Unfortunately I get the following error message now:
Any thoughts on how I could solve this problem?
You should try $this->controller->getSiteModel().