Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-12-2007, 10:12 AM
Junior Member
 
Join Date: Dec 2007
Posts: 3
Default How to get controller or view name from helper

Dear All

I am new in ZF, I am writing a view helper.
I found the helper can't get the view's name or the controller's name,
because my helper needs to know which view or controller using it.
I am sorry, I am a lazy guy, I hope I don't need to pass a parameter to the helper but
the helper can get the information by itself.

Does anyone know how to let the view help get this information.

Thanks you all
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 12-13-2007, 11:01 AM
Junior Member
 
Join Date: Nov 2007
Location: Belgium
Posts: 1
Send a message via ICQ to DragonBe Send a message via MSN to DragonBe Send a message via Skype™ to DragonBe
Default

Yes, I'm facing the same issues here and I don't want to retrieve it using old-style coding.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 12-13-2007, 11:33 PM
SpotSec's Avatar
Senior Member
 
Join Date: Feb 2007
Location: United States
Posts: 121
Default

http://fisheye3.cenqua.com/browse/~r...GetRequest.php

$this->getRequest()->getControllerName() etc...
This view helper exposes the request obj in the view. While it is not exactly good practice to be accessing request vars in the view, its useful for debugging occasionally
__________________
Zym Framework - A Zend Framework extension library w/ demo app

SpotSec Blog:
http://spotsec.com/blog
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 12-14-2007, 04:42 AM
Junior Member
 
Join Date: Dec 2007
Posts: 3
Default

Thanks a lot , I think it may the final answer.

Zend_Controller_Front::getInstance()->getRequest()->getControllerName();

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 03:20 PM.