Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7706623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:10:07+00:00 2026-06-01T00:10:07+00:00

in this tutorial of Yii framework http://www.yiiframework.com/doc/guide/1.1/en/basics.controller#action i want to put my Actions from

  • 0

in this tutorial of Yii framework
http://www.yiiframework.com/doc/guide/1.1/en/basics.controller#action

i want to put my Actions from a Controller to a separate action files
and as the instructions said “create a Action class”

and this is my action class file

class LoginAction extends CAction
{

    private $contents = array();
    public function run(){
        $loginmodel = new LoginForm;

        //answer ajax validating request
        if(isset($_POST['ajax']) && $_POST['ajax']==='login-form'){
            echo CActiveForm::validate($loginmodel);
            Yii::app()->end();
        }

        //collect user input data to do login
        if(isset($_POST["LoginForm"]))
        {
            $loginmodel->attributes = $_POST["LoginForm"];
            // validate user input and redirect to the previous page if valid
            if($loginmodel->validate() && $loginmodel->login()){ //<--invoking here the login and validate function
                $this->redirect(Yii::app()->user->returnUrl);
            }
        }

        $this->contents["loginmodel"] =  $loginmodel;
        $this->render('index',$this->contents); 
    }    

}

and in my Controller

class SandboxController extends Controller{       
    public function actions(){
        // return external action classes, e.g.:
            return array(
            'authlog'=>'application.controllers.authentication.LoginAction',
            // page action renders "static" pages stored under 'protected/views/site/pages'
            // They can be accessed via: index.php?r=site/page&view=FileName
            'page'=>array(
                'class'=>'CViewAction',
            ),
        );   
    }
}

and i browse the separate action controller using

http://localhost/mysite/index.php/sandbox/authlog/login

and my error is

LoginAction and its behaviors do not have a method or closure named
“render”.

do i went wrong on something? thanks.

here is the stacktrace

CException LoginAction and its behaviors do not have a method or
closure named “render”.

D:\xampp\htdocs\mysite\framework\base\CComponent.php(266)

254 public function __call($name,$parameters) 255 { 256
if($this->_m!==null) 257 { 258 foreach($this->_m
as $object) 259 { 260
if($object->getEnabled() && method_exists($object,$name)) 261
return call_user_func_array(array($object,$name),$parameters); 262
} 263 } 264 if(class_exists(‘Closure’, false) &&
$this->canGetProperty($name) && $this->$name instanceof Closure) 265
return call_user_func_array($this->$name, $parameters); 266
throw new CException(Yii::t(‘yii’,'{class} and its behaviors do not
have a method or closure named “{name}”.’, 267
array(‘{class}’=>get_class($this), ‘{name}’=>$name))); 268 } 269
270 /** 271 * Returns the named behavior object. 272 *
The name ‘asa’ stands for ‘as a’. 273 * @param string $behavior
the behavior name 274 * @return IBehavior the behavior object, or
null if the behavior does not exist 275 */ 276 public
function asa($behavior) 277 { 278 return
isset($this->_m[$behavior]) ? $this->_m[$behavior] : null; Stack Trace

0

  • D:\xampp\htdocs\mysite\protected\controllers\authentication\LoginAction.php(26):
    CComponent->__call(“render”, array(“index”, array(“loginmodel” =>
    LoginForm)))

    1

  • D:\xampp\htdocs\mysite\protected\controllers\authentication\LoginAction.php(26):
    LoginAction->render(“index”, array(“loginmodel” => LoginForm))

    2

  • D:\xampp\htdocs\mysite\framework\web\actions\CAction.php(75): LoginAction->run()

    3

  • D:\xampp\htdocs\mysite\framework\web\CController.php(309): CAction->runWithParams(array(“login” => “”))

    4

  • D:\xampp\htdocs\mysite\framework\web\CController.php(287): CController->runAction(LoginAction)

    5

  • D:\xampp\htdocs\mysite\framework\web\CController.php(266): CController->runActionWithFilters(LoginAction, array())

    6

  • D:\xampp\htdocs\mysite\framework\web\CWebApplication.php(276): CController->run(“authlog”)

    7

  • D:\xampp\htdocs\mysite\framework\web\CWebApplication.php(135): CWebApplication->runController(“sandbox/authlog/login”)

    8

  • D:\xampp\htdocs\mysite\framework\base\CApplication.php(162): CWebApplication->processRequest()

    9

  • D:\xampp\htdocs\mysite\index.php(13): CApplication->run() 2012-03-05 09:37:43 Apache/2.2.21 (Win32) mod_ssl/2.2.21
    OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1 Yii
    Framework/1.1.10

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T00:10:07+00:00Added an answer on June 1, 2026 at 12:10 am

    The problem is with this line of code:

    $this->render('index',$this->contents);
    

    This would be fine if it were inside a controller, but once the code is moved inside a dedicated action class there’s no longer a render method to be called on $this, hence the error.

    You simply need to get a reference to the controller first and call render on that:

    $controller=$this->getController();
    $controller->render('index',$this->contents);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using this tutorial: http://www.c-sharpcorner.com/uploadfile/UrmimalaPal/creating-a-windows-phone-7-application-consuming-data-using-a-wcf-service/ I have created sample/hello world application on the windows phone
This tutorial http://www.blocsoft.com/blog/imageshack.asp shows a great way to upload to imageshack and get a
From this tutorial http://www.brighthub.com/internet/web-development/articles/11010.aspx I found the code below. Is there a way to
In this tutorial: http://www.objectdb.com/tutorial/jpa/eclipse/ee/servlet Is @EJB GuestDao guestDao; merely a way of loading the
In this tutorial http://www.codeproject.com/KB/IP/ThinVnc.aspx it says: ThinVNC is not a traditional VNC, as it
I've been following this tutorial, which is great btw, and have one question. http://www.larryullman.com/2010/01/07/custom-authentication-using-the-yii-framework/
Following this tutorial (http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/handling-concurrency-with-the-entity-framework-in-an-asp-net-mvc-application), I learned how to save data and do concurrency checks
i'm following this tutorial: http://code.google.com/p/modwsgi/wiki/QuickInstallationGuide and downloading my own source of mod_wsgi. The problem
This tutorial - http://andytsui.wordpress.com/2011/06/29/tutorial-displaying-multiple-lists-in-one-single-listview-with-android-binding/ - shows exactly what I want to do, but it
Followed this tutorial on getting autocomplete for CI to work with Eclipse http://taggedzi.com/articles/display/autocomplete-eclipse-codeigniter-2 -

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.