Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.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
View 通过打字脚本选择要使用的视图_View_Typo3_Typoscript_Extbase - Fatal编程技术网

View 通过打字脚本选择要使用的视图

View 通过打字脚本选择要使用的视图,view,typo3,typoscript,extbase,View,Typo3,Typoscript,Extbase,如果我有下面的打字脚本让页面呈现来自控制器的操作,我是否也可以使用它来设置另一个视图而不是默认视图 151 = USER_INT 151 { userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run pluginName = Pi1 extensionName = WdProducts controller = Products vendorName = Bitmotion action = s

如果我有下面的打字脚本让页面呈现来自控制器的操作,我是否也可以使用它来设置另一个视图而不是默认视图

  151 = USER_INT
  151 {
    userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
    pluginName = Pi1
    extensionName = WdProducts
    controller = Products
    vendorName = Bitmotion
    action = showFromTyposcriptAction

    switchableControllerActions {
      Products {
        1 = showFromTyposcript
      }
    }

    settings =< plugin.tx_wdproducts.settings
    persistence =< plugin.tx_wdproducts.persistence
    view =< plugin.tx_wdproducts.view
    update =< plugin.tx_wdproducts.update
  }
151=USER\u INT
151 {
userFunc=TYPO3\CMS\Extbase\Core\Bootstrap->run
pluginName=Pi1
extensionName=WdProducts
控制器=产品
vendorName=Bitmotion
action=showFromTypeScriptAction
可切换控制器动作{
产品{
1=showFromTyposcript
}
}
设置=
呈现的视图是
ShowFromTyposcript.html
,但我想要查看
Show.html
。或者我可以使用
settemplatepath和filename
从控制器中设置另一个视图(已尝试但未使其工作)


我使用TYPO3 6.2。

创建两个插件,即:
ShowFromTyposcript
Show
作为
ext\u localconf.php
中的第一个使用所需操作,因此您可以:

10 = USER
10 {
  userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
  extensionName = WdProducts
  pluginName = ShowFromTyposcript
  vendorName = Bitmotion
}

20 = USER
20 {
  userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
  extensionName = WdProducts
  pluginName = Show
  vendorName = Bitmotion
}
另一种方法是使用一个通用操作将
转发给其他操作,具体取决于条件:

public function showFromTyposcriptAction(){
    if (intval(GeneralUtility::_GET('product'))>0){
        $this->forward('show');
    }
    ....
}


public function showAction(){
    $productUid = intval(GeneralUtility::_GET('product'));
    $product = $this->productRepository->finByUid($prodcutUid);
    ....
}

对于第一种方法,我可以对不同的操作使用相同的视图吗?我理解的第二种方法,谢谢。在Extbase中,
Product
controller的action name=view name.:即:'showAction'放在
../Product/Show.html
文件中,如果要打破这一规则,需要使用
StandaloneView
类: