public function forwardUrl($url){

        //get the current request
        $request = common_http_Request::currentRequest();
        $params = $request->getParams();

        //parse the given URL
        $parsedUrl = parse_url($url);

        //if new parameters are given, then merge them 
        if(isset($parsedUrl['query']) && strlen($parsedUrl['query']) > 0){
            $newParams = array();
            parse_str($parsedUrl['query'], $newParams);
            if(count($newParams) > 0){
                $params = array_merge($params, $newParams);
            }
        }

        //resolve the given URL for routing
        $resolver = new Resolver(new common_http_Request($parsedUrl['path'], $request->getMethod(), $params));
        $this->propagate($resolver);

	    $context = Context::getInstance();

        // load the responsible extension
        common_ext_ExtensionsManager::singleton()->getExtensionById($resolver->getExtensionId());
   
        //update the context to the new route
        $context->setExtensionName($resolver->getExtensionId());
        $context->setModuleName($resolver->getControllerShortName());
		$context->setActionName($resolver->getMethodName());
        if(count($params) > 0){
            $context->getRequest()->addParameters($params);
        }

        //add a custom header so the client knows where the route ends
        header(self::FORWARD_HEADER . ': ' . $resolver->getExtensionId() . '/' .  $resolver->getControllerShortName() . '/' . $resolver->getMethodName());

        //execite the new action
        $enforcer = new ActionEnforcer($resolver->getExtensionId(), $resolver->getControllerClass(), $resolver->getMethodName(), $params);
        $this->propagate($enforcer);
        $enforcer->execute();

        //should not be reached
        throw new InterruptedActionException('Interrupted action after a forward',
                                             $context->getModuleName(),
                                             $context->getActionName());
                
    }
public function forwardUrl($url){

        //get the current request
        $request = common_http_Request::currentRequest();
        $params = $request->getParams();

        //parse the given URL
        $parsedUrl = parse_url($url);

        //if new parameters are given, then merge them 
        if(isset($parsedUrl['query']) && strlen($parsedUrl['query']) > 0){
            $newParams = array();
            parse_str($parsedUrl['query'], $newParams);
            if(count($newParams) > 0){
                $params = array_merge($params, $newParams);
            }
        }

        //resolve the given URL for routing
        $resolver = new Resolver(new common_http_Request($parsedUrl['path'], $request->getMethod(), $params));
        $this->propagate($resolver);

	    $context = Context::getInstance();

        // load the responsible extension
        common_ext_ExtensionsManager::singleton()->getExtensionById($resolver->getExtensionId());
   
        //update the context to the new route
        $context->setExtensionName($resolver->getExtensionId());
        $context->setModuleName($resolver->getControllerShortName());
		$context->setActionName($resolver->getMethodName());
        if(count($params) > 0){
            $context->getRequest()->addParameters($params);
        }

        //add a custom header so the client knows where the route ends
        header(self::FORWARD_HEADER . ': ' . $resolver->getExtensionId() . '/' .  $resolver->getControllerShortName() . '/' . $resolver->getMethodName());

        //execite the new action
        $enforcer = new ActionEnforcer($resolver->getExtensionId(), $resolver->getControllerClass(), $resolver->getMethodName(), $params);
        $this->propagate($enforcer);
        $enforcer->execute();

        //should not be reached
        throw new InterruptedActionException('Interrupted action after a forward',
                                             $context->getModuleName(),
                                             $context->getActionName());
                
    }
public function forwardUrl ( $ url ) { //get the current request $ request = common_http_Request :: currentRequest ( ) ; $ params = $ request -> getParams ( ) ; //parse the given URL $ parsedUrl = parse_url ( $ url ) ; //if new parameters are given, then merge them  if ( isset ( $ parsedUrl [ 'query' ] ) && strlen ( $ parsedUrl [ 'query' ] ) > 0 ) { $ newParams = array ( ) ; parse_str ( $ parsedUrl [ 'query' ] , $ newParams ) ; if ( count ( $ newParams ) > 0 ) { $ params = array_merge ( $ params , $ newParams ) ; } } //resolve the given URL for routing $ resolver = new Resolver ( new common_http_Request ( $ parsedUrl [ 'path' ] , $ request -> getMethod ( ) , $ params ) ) ; $ this -> propagate ( $ resolver ) ; $ context = Context :: getInstance ( ) ; // load the responsible extension common_ext_ExtensionsManager :: singleton ( ) -> getExtensionById ( $ resolver -> getExtensionId ( ) ) ; //update the context to the new route $ context -> setExtensionName ( $ resolver -> getExtensionId ( ) ) ; $ context -> setModuleName ( $ resolver -> getControllerShortName ( ) ) ; $ context -> setActionName ( $ resolver -> getMethodName ( ) ) ; if ( count ( $ params ) > 0 ) { $ context -> getRequest ( ) -> addParameters ( $ params ) ; } //add a custom header so the client knows where the route ends header ( self :: FORWARD_HEADER . ': ' . $ resolver -> getExtensionId ( ) . '/' . $ resolver -> getControllerShortName ( ) . '/' . $ resolver -> getMethodName ( ) ) ; //execite the new action $ enforcer = new ActionEnforcer ( $ resolver -> getExtensionId ( ) , $ resolver -> getControllerClass ( ) , $ resolver -> getMethodName ( ) , $ params ) ; $ this -> propagate ( $ enforcer ) ; $ enforcer -> execute ( ) ; //should not be reached throw new InterruptedActionException ( 'Interrupted action after a forward' , $ context -> getModuleName ( ) , $ context -> getActionName ( ) ) ; }
Forward the action to execute reqarding a URL
The forward runs into tha same HTTP request unlike redirect.
@param string $url the url to forward to
Forward the action to execute reqarding a URL The forward runs into tha same HTTP request unlike redirect .