Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/apache-flex/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Module SocialEngine 4-获取操作名称_Module_Controller_Action_Core_Socialengine - Fatal编程技术网

Module SocialEngine 4-获取操作名称

Module SocialEngine 4-获取操作名称,module,controller,action,core,socialengine,Module,Controller,Action,Core,Socialengine,希望有人告诉我如何从模块核心控制器获取操作名,而不是执行操作,使用操作名作为变量来确定要输出的内容 基本上,我正在切换到SocialEngine而不是我的wordpress安装,为了保持我的旧页面结构,我正在设置用于提取页面输出的模块。所以,我为雕塑设置了一个控制器,然后每个雕塑数据都存储在一个数据库表中 因此,当有人进入MyDomain/Scullations时,他们将从数据库中获取一个列表,该列表将动态生成URL,用于导航到单个雕刻页面。。。当然,这将是MyDomain/scultures/

希望有人告诉我如何从模块核心控制器获取操作名,而不是执行操作,使用操作名作为变量来确定要输出的内容

基本上,我正在切换到SocialEngine而不是我的wordpress安装,为了保持我的旧页面结构,我正在设置用于提取页面输出的模块。所以,我为雕塑设置了一个控制器,然后每个雕塑数据都存储在一个数据库表中

因此,当有人进入MyDomain/Scullations时,他们将从数据库中获取一个列表,该列表将动态生成URL,用于导航到单个雕刻页面。。。当然,这将是MyDomain/scultures/sculpturename

它通常会在控制器中执行公共函数sculpturenameAction()函数,但是,我想截取动作名称并执行一个不同的函数,该函数将根据动作名称为各个雕刻页面提供数据


这可能吗?我该怎么做?

谢谢@Jitendra Bansal这读起来好像是我在寻找的,但类声明并不完全是我在做的。我不是在创建插件。。。下面是我使用的:
class Core\u雕刻控制器扩展了Core\u Controller\u Action\u标准{
Yes,Ryan您可以在控制器类中使用以下代码找到操作名称:$front=Zend\u Controller\u front::getInstance();$Action=$front->getRequest()->getActionName();但如果要将路由转移到其他操作,则必须使用routeShutdown()方法。如果有任何疑问,请告诉我。
You can get the current module, controller and action name using below code:

$front = Zend_Controller_Front::getInstance();
$module = $front->getRequest()->getModuleName();
$controller = $front->getRequest()->getControllerName();
$action = $front->getRequest()->getActionName();

If you want to divert the route or want to run some other code at some action than you can use the routeShutdown() method. Please see the below example for this:

    class yourModuleName_Plugin_Core extends Zend_Controller_Plugin_Abstract {

        public function routeShutdown(Zend_Controller_Request_Abstract $request) {

            $module = $request->getModuleName();
            $controller = $request->getControllerName();
            $action = $request->getActionName();

            //ADD YOUR ACTION CONDITION
            if ($module == 'core' && $controller == 'index' && $action == 'index') {

                //SET SOME OTHER ACTIONS OR YOU CAN WRITE SOME OTHER CODE
                $request->setModuleName('yourModuleName');
                $request->setControllerName('yourControllerName');
                $request->setActionName('yourActionName');
            }
        }
    }

Hope this answer will helps you. Thank you !!