Php Typo3 RealURL:UID带前导零
假设以下类型3 RealURL设置:Php Typo3 RealURL:UID带前导零,php,typo3,realurl,leading-zero,Php,Typo3,Realurl,Leading Zero,假设以下类型3 RealURL设置: 'news' => array( array( 'GETvar' => 'tx_news_pi1[action]', ), array( 'GETvar' => 'tx_news_pi1[controller]', ), array( 'GETvar' => '
'news' => array(
array(
'GETvar' => 'tx_news_pi1[action]',
),
array(
'GETvar' => 'tx_news_pi1[controller]',
),
array(
'GETvar' => 'tx_news_pi1[news]',
'lookUpTable' => array(
'table' => 'tx_news_domain_model_news',
'id_field' => 'uid',
'alias_field' => 'CONCAT(title, "-", uid)',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-',
),
'languageGetVar' => 'L',
'languageExceptionUids' => '',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'autoUpdate' => 1,
'expireDays' => 180,
),
),
),
关于这一行:'alias\u field'=>'CONCAT(title,“-”,uid)”,
我需要将前导零添加到uid
,这样它至少有三位数字
在数组外部,它应该是:
$uid=sprintf(“%03d”,$uid)代码>您可以使用MySQL函数
它看起来像这样:
'alias_field' => "CONCAT(title, '-', LPAD(uid, 3,'0'))",