Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

Acessing Controller and Action name at _initVars() Zend Framework -


i hope had made me clear in question!

i access getcontrollername() , getactionname() inside _initvars(). i'm trying do:

    protected function _initvars()      {          $this->bootstrap('layout');         $layout = $this->getresource('layout');         $view = $layout->getview();         $view->theme = 'my_theme';           $this->bootstrap('frontcontroller');         $front = $this->getresource('frontcontroller');           echo '<pre>';         print_r($front->getrequest());         echo '</pre>';         exit;          return $view;      } 

i'm getting no response, fields controllername , actionname returning empty, in return:

zend_controller_front object (     [_baseurl:protected] =>      [_controllerdir:protected] =>      [_dispatcher:protected] => zend_controller_dispatcher_standard object         (             [_curdirectory:protected] =>              [_curmodule:protected] => default             [_controllerdirectory:protected] => array                 (                     [default] => /var/www/proj_rodrigo/application/controllers                 )              [_defaultaction:protected] => index             [_defaultcontroller:protected] => index             [_defaultmodule:protected] => default             [_frontcontroller:protected] =>              [_invokeparams:protected] => array                 (                 ) 

it's part of code, necessary things there, in old schema of zend capable calling zend_front_controller, don't know more how use it.

appreciate help! best regards , sorry bad english.

to fix issue, add postdispatche @ plugin:

public function postdispatch(zend_controller_request_abstract $request) {

$bootstrap = zend_controller_front::getinstance()->getparam('bootstrap'); $layout = $bootstrap->getresource('layout'); $view = $layout->getview();  $view->controller = $this->getrequest()->getcontrollername(); $view->action = $this->getrequest()->getactionname(); 

}

thanks again!

it looks code in bootstrap class. since bootstrap code runs before routing - in, fact stage routing defined - controller , action not yet determined.

if want info, need create front-controller plugin implementing early-running method - runs after routing has set controller , action - routeshutdown() or dispatchloopstartup()or predispatch().

check out: zf dispatch overview (pdf)


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -