我有一个带有列表和显示操作的扩展。目前,此扩展程序可以出现在多个页面上:
/page-1/
/page-2/subpage/
我是这样配置realurl
的:
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']=array (
'encodeSpURL_postProc' => array('user_encodeSpURL_postProc'),
'decodeSpURL_preProc' => array('user_decodeSpURL_preProc'),
'_DEFAULT' => array (
…
'postVarSets' => array(
'_DEFAULT' => array(
'controller' => array(
array(
'GETvar' => 'tx_extension_plugin[controller]',
'noMatch' => 'bypass',
),
),
'extension' => array(
array(
'GETvar' => 'tx_extension_plugin[action]',
),
array(
'GETvar' => 'tx_extension_plugin[controller]',
),
array(
'GETvar' => 'tx_extension_plugin[value]',
'lookUpTable' => array(
'table' => 'table',
'id_field' => 'uid',
'alias_field' => 'name',
'addWhereClause' => ' AND NOT deleted AND NOT hidden',
…
);
function user_decodeSpURL_preProc(&$params, &$ref) {
$params['URL'] = str_replace('page-1/', 'page-1/extension/', $params['URL']);
}
function user_encodeSpURL_postProc(&$params, &$ref) {
$params['URL'] = str_replace('page-1/extension/', 'page-1/', $params['URL']);
}
现在我得到如下网址:
/page-1/ /* shows list */
/page-1/Action/show/name-of-single-element /* single view */
我真正想要的是:
/page-1/name-of-single-element /* single view */
如何摆脱动作和控制器?
如果我删除:
array('GETvar' => 'tx_extension_plugin[action]'),
array('GETvar' => 'tx_extension_plugin[controller]'),
它将参数附加到 URL。