2012-06-13 28 views
1

我有一个看起来像这样的URL:TYPO3 RealURL postVarSets隐藏关键字

http://domain.com/leistungen/industrial-design/?tx_fsproject_fsprojectfp%5Bproject%5D=2&tx_fsproject_fsprojectfp%5Baction%5D=show&tx_fsproject_fsprojectfp%5Bcontroller%5D=Project&cHash=7c405bcde49853af9a7e78bdf465002c 

使用RealURL具有以下配置(以及一些钩子函数的解释here):我得到一个

'postVarSets' => array(
     '_DEFAULT' => array(
      // projects 
      'industrial-design' => array(
       array(
        'GETvar' => 'tx_fsproject_fsprojectfp[controller]', 
       ), 
       array(
        'GETvar' => 'tx_fsproject_fsprojectfp[action]', 
       ), 
       array(
        'GETvar' => 'tx_fsproject_fsprojectfp[project]', 
        'lookUpTable' => array(
         'table' => 'tx_fsproject_domain_model_project', 
         'id_field' => 'uid', 
         'alias_field' => 'title', 
         'addWhereClause' => ' AND deleted !=1 AND hidden !=1', 
         'useUniqueCache' => 1, 
         'useUniqueCache_conf' => array(
          'strtolower' => 1, 
          'spaceCharacter' => '-', 
         ) 
        ) 
       ), 
      ), 
     ), 
    ), 

URL看起来像这样:

http://domain.com/leistungen/industrial-design/industrial-design/projekt/project-b/ 

这并不坏。但是,为什么industrial-design/部分显示两次?

回答

5

第一个工业设计是正在显示的页面。第二个是RealURL插入的关键字,用于识别变量集。为了避免这种情况,您可以:

  1. 更改的页面结构,让你不必工业设计页面做的。
  2. 重命名您在RealURL配置中设置的postVarSets
  3. 使用fixedPostVars而不是使用关键字来标识一组变量,而是一个页面UID。
+0

'fixedPostVarSets'完成了这项工作。感谢你们俩。 –

+2

我很好奇......我找不到有关'fixedPostVarSets'的文档或如何使用它。所有在线示例仅将其作为空数组。如果你是谷歌,你只能在这里找到这个职位。它是否像'postVarSets'一样使用页面ID而不是'_DEFAULT',或者页面ID而不是postVar关键字? – slhck

+1

@slhck:S ***!对不起。我现在意识到它应该是'fixedPostVars'。在写我的答案时,由于RealURL的混合命名:'postVarSets' VS'preVars','fixedPostVars',我输入错误。我不敢相信这个错误留在了这么久的答案中。感谢您指出! – tmt