TYPO3 Realurl配置类别页面
我有打字错误37.6.10。 我有个好消息 我想按类别为我的页面配置新闻。 现在我有:TYPO3 Realurl配置类别页面,typo3,categories,realurl,Typo3,Categories,Realurl,我有打字错误37.6.10。 我有个好消息 我想按类别为我的页面配置新闻。 现在我有: 'newsCategoryConfiguration' => array( array( 'GETvar' => 'tx_news_pi1[overwriteDemand][categories]', 'lookUpTable' => array( 'table' => 'sys_category',
'newsCategoryConfiguration' => array(
array(
'GETvar' => 'tx_news_pi1[overwriteDemand][categories]',
'lookUpTable' => array(
'table' => 'sys_category',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-'
)
)
)
),
它起作用了,结果是:
/domain/page-With-List-Of-News-By-Category/Category
/domain/-page-With-List-Of-News-By-Category/Category
如果有子类别,结果是:
/domain/page-With-List-Of-News-By-Category/Category
/domain/-page-With-List-Of-News-By-Category/Category
我可以得到:
/domain/page-With-List-Of-News-By-Category/Parent-Category/Sub-Category
也许有更快更好的方法。但如果找不到,请尝试以下方法,并使用userfunc以这种方式自行构建:
'useUniqueCache_conf' => [
'strtolower' => 1,
'spaceCharacter' => '-',
'encodeTitle_userProc' => 'My\Ext\Hooks\News\RealUrlCategories->buildCategoryPath'
];
这门课是这样的:
class RealUrlCategories {
function buildCategoryPath($parameters) {
$categoriesPath = '';
// find category rootline
// you can find the uid somewhere in $parameters, then iterate for parent categories and read db for the titles to build final string
...
// return generated string like "Parent-Category/Sub-Category"
return $categoriesPath;
}
}
问题是,realURL使用rawurlencode解析userFunc的结果。因此,
父类别/子类别
将转换为父类别%252f子类别
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['encodespul_postProc']
钩子中将~~替换为一个//code>,但~~将存储在缓存中
parent\u category
,但此可选参数在fixesPostVars
部分不起作用,因为此处参数是必需的,因此如果该参数为空,则URL中有一个双斜杠//类别除了使用“父类别”子类别的格式之外,您还能找到其他解决方案吗?根本没有效果,或者没有按预期工作?确保调用了userfunc。清除自动加载缓存。完全无效。realurl的版本为:2.0.14。我清除所有缓存。检查是否调用了userfunc?放入一些骰子('is called!');里面,或者类似的东西。它应该中断脚本执行。如果什么都没发生,就不叫了。确保名称空间和正确的脚本位置,以便自动加载可以找到它。我将die('is called')放在'class RealUrlCategories'之前,但什么也没有发生:(