我尝试使用Realurl1.12.8和http://www.example.com/page/extensionname/MyArticleNumber/ 6.2.27将生成的url从http://www.example.com/page/extensionname/MyArticleNumber/更改为http://www.example.com/page/MyArticleNumber/。我的realurl_conf.php:
'postVarSets' => array(
'_DEFAULT' => array(
'extensionname' => array(
array(
'GETvar' => 'extensionname_plugin[article]',
'lookUpTable' => array(
'table' => 'tx_extensionname_domain_model_article',
'id_field' => 'uid',
'alias_field' => 'CONCAT(short_title, \'-\', juq)',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'spaceCharacter' => '-',
),
),
),
),
),为了解决这个问题,我需要编辑什么,在哪里编辑?提前谢谢你。
发布于 2016-11-14 10:31:59
如果你在一个特定的页面上使用你的扩展,你可以使用'fixedPostVars‘
'fixedPostVars' => array(
# extension configuration
'extensionname' => array(
array(
'GETvar' => 'extensionname_plugin[article]',
'lookUpTable' => array(
'table' => 'tx_extensionname_domain_model_article',
'id_field' => 'uid',
'alias_field' => 'CONCAT(short_title, \'-\', juq)',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'spaceCharacter' => '-',
),
),
),
),
# PID for extension configurations
'99' => 'extensionname',
),发布于 2016-11-14 12:03:58
我已经使用了encodeSpURL_postProc和decodeSpURL_preProc函数的realUrl。
下面的代码已添加到我的realurl_conf.php文件中:
<?php
$GLOBALS['realURLEncodeSpURLArray'] = array(
'url/by/realurl/' => 'new/url/',
'page/extensionname/' => 'page/'
);
function user_encodeSpURL_postProc(&$params, &$ref)
{
$params['URL'] = str_replace(array_keys($GLOBALS['realURLEncodeSpURLArray']), array_values($GLOBALS['realURLEncodeSpURLArray']), $params['URL']);
}
function user_decodeSpURL_preProc(&$params, &$ref)
{
$params['URL'] = str_replace(array_values($GLOBALS['realURLEncodeSpURLArray']), array_keys($GLOBALS['realURLEncodeSpURLArray']), $params['URL']);
}
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'] = array(
'encodeSpURL_postProc' => array('user_encodeSpURL_postProc'),
'decodeSpURL_preProc' => array('user_decodeSpURL_preProc'),
'_DEFAULT' => array(
...
);请确保new/url/应该是唯一的,这样就不会有冲突。
例如:如果您想映射txnews,您将得到一个类似于mynewspage/details/txnews/article的url,您应该将mynewspage/details/txnews/替换为mynewspage/details/。不要用txnews/代替/!
https://stackoverflow.com/questions/40585886
复制相似问题