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


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-28-2008, 05:55 PM
Junior Member
 
Join Date: Apr 2008
Posts: 1
Question Request in Zend_View

Hello,
I have a layout.phtml and I need to get controller name and other several GET variables in there, however I can't do this.

In ControllerName.php I can do it by $this->_request->getParam("controller"), but in layout.phtml $this IS Zend_View I guess, so I can't get a query variable from there.

Can anyone help me with this? Any suggestions are appriciated.
Thank you in Advance!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-30-2008, 01:46 PM
Elemental's Avatar
Senior Member
 
Join Date: Jul 2007
Posts: 119
Default

You should assign the controller name to a view variable you can call from within the view/layout scope. Typically its bad design to call the request/controller/... from the view scope, you should already have all the data processing done by then.

So in your controller:
PHP Code:
$this->view->assign('controllerName'$this->_request->getParam('controller')); 
Then in the layout or view:
PHP Code:
<?= $this->controllerName?>
__________________
Zend Framework Resources: Zend Webinars | Reference Manual | API Docs | Books | FreeNode: #zftalk
Getting Started Tutorials: Getting started with ZF | Getting started with Zend Auth
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 10:17 AM.