Thursday, July 5, 2012

Getting action/controller/module name in Yii

Some times we need to know the current controller/module/action name in our application, Yii provides the default methods to accomplish the tasks.

To get a controller name
Yii::app()->controller->id //or
Yii::app()->getController()->getId()
$this->id  here $this refers to current controller 

To get method/action name
Yii::app()->controller->action->id
You can get action name in controller
$this->action->id

To get module name
Yii::app()->controller->module->id
$this->module->id

8 comments:

Aasha said...


This blog explains the details about what happened after the expressions. This gives the

details of the thinking next what to do. All that are discussed and provide a grateful

talk
Digital Marketing Company in Chennai

Anil Gupta said...

The blog is absolutely truly incredible. Lots of large information and inspiration, both of which we all need.
Bangalore Web Designing Company, UI Designing Company Bangalore

Prasanth said...

Thanks for the information.Helped us to convince most on how this process work and what they could achieve by following these guidelines.
UI Designing Company in Bangalore, Web Application Development Companies in Bangalore

Radley Co Tad said...


I have read your blog its very attractive and impressive. I like it your blog.

PHP Training in chennai | PHP Training Course

PHP Training in chennai | Online PHP Course

devidnayana said...

I am very happy when read this blog post because blog post written in good manner and write on
good topic. Thanks for sharing valuable information.

School Information Management System,
Online Fee Payment Integration
College Management System

Message

cyber news said...

thanks for sharing the information.Indian Cyber Army is announcing “ Summer Internship 2018” on “ Ethical hacking and Cyber Crime Investigation” for the enthusiasts of Cyber security. Here internship will give you on-the-job experience, help you learn whether you and Cyber security industry are a good match and can provide you with valuable connections and references. Here interns are usually exposed to a wide variety of tasks and responsibilities which allows the intern to showcase their strengths by working on projects for various managers that work on different parts of Indian Cyber Army. Becoming a high performing intern is a fantastic way to improve your employment prospects. This internship can be a great way to get your foot in the door of success with a prestigious or desirable Organization

cyber news said...

Thanks for the information.It is really nice .Information security is the set of processes that maintain the confidentiality, integrity and availability of business data in its various forms.In this age of Technology advancement, computer and information technology have not only brought convenience to citizens in modern life but also for policemen & various Government officials of the nation to fight cybercrime through various modus operandi. Indian Cyber Army has been dedicated in fighting cyber crime, striving to maintain law and order in cyberspace so as to ensure that everyone remains digitally safe.Read more:- Information Security

cyber news said...

thanks for sharing the more valuable information.
Indian Cyber Army credibility in Ethical hacking training & Cybercrime investigation training is acknowledged across nation as we offer hands on practical knowledge and full assistance with basic as well as advanced level ethical hacking & cybercrime investigation courses. The training is conducted by subject specialist corporate professionals with wide experience in managing real-time ethical hacking/ cyber security projects. Indian Cyber Army implements a blend of academic learning and practical sessions to give the candidate optimum exposure.Ethical hacking training ,
Ethical hacking course