tt_address:将地址类别添加到模板 [英] tt_address: add categorys of address to the template
问题描述
是否可以通过某种方式添加地址分配给html输出的cetrain组的子组?
Is it somehow possible to add the sub-group of a cetrain group the address is assigned to the html output?
在模板中,我有###MAINGROUP###
和###GROUPLIST###
.我不能使用maingroup,因为并不是我需要的组始终是maingroup.而且在群组列表中,我无法说出哪个群组是该群组的子群组.
In the template I have ###MAINGROUP###
and ###GROUPLIST###
. I can't use maingroup, cause it's not the case that the group I need is always the maingroup. And with the grouplist I can't say which group is the sub-group of the one group.
有人知道我该怎么做吗?
Anyone have an idea how I could do it?
此外,我还需要tt_address表中一个自己创建的字段的值.
And in addition to that I also need the value of a self created field in the tt_address table.
我像@lorenz所说的那样尝试.到目前为止,我所拥有的:
I try it like @lorenz say. What I have so far:
ext_localconf.php:
ext_localconf.php:
<?php
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['tt_address']['extraItemMarkerHook'][]
='EXT:txnextaddresssort/class.tx_next_address_sort_addmarkers.php:tx_next_address_sort_addmarkers';
class.tx_next_address_sort_addmarkers.php:
class.tx_next_address_sort_addmarkers.php:
<?php
class tx_next_address_sort_addmarkers {
function extraItemMarkerProcessor(&$markerArray, &$address, &$lConf,
&$pObj) {
$lcObj = t3lib_div::makeInstance('tslib_cObj');
$lcObj->data = $address;
$markerArray['###SORTBEREICH###'] =
$lcObj->stdWrap($address['tx_nextaddresssort_sort_bereich'],
$lConf['tx_nextaddresssort_sort_bereich.']);
}
}
扩展密钥:next_address_sort
Extentionkey: next_address_sort
我得到的只是一个空白屏幕,但是apache日志中没有错误
All I get is a blank screen, but no errors in apache log
推荐答案
不,不可能这样做.
但是,您可以编写一个自定义扩展,该扩展在tt_address中集成了extraItemMarkerProcessorhook.在ext_localconf.php中,添加:
Yet you can write a custom extension that integrates the extraItemMarkerProcessorhook in tt_address. In ext_localconf.php, add:
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['tt_address']['extraItemMarkerHook'][] ='EXT:myextension/class.tx_myextension_filename.php:tx_myextension_classname';
然后在扩展名中添加文件class.tx_myextension_filename.php.
Then add a file class.tx_myextension_filename.php to your extension.:
class tx_myextension_classname {
public function extraItemMarkerProcessor(&$markerArray, &$address, &$lConf, &$pObj) {
$lcObj = t3lib_div::makeInstance('tslib_cObj');
$lcObj->data = $address;
$markerArray['###MYFIELD###'] = $lcObj->stdWrap($address['myfieldlikeindatabase'], $lConf['myfieldlikeindatabase.']);
return $markerArray;
}
}
这是获取tt_address表中的字段并将其添加到标记中以便可以在模板中使用的示例.它还启用了stdWrap.
This would be an example for getting a field that is in the tt_address table and adding it to the markers so they can be used in a template. It is also stdWrap enabled.
现在,代替获取字段,您应该将$ address ['myfieldlikeindatabase']替换为包含所需信息的变量.要接收数据,可以使用TYPO3数据库API函数($ GLOBALS ['TYPO3_DB']).
Now, instead of getting a field, you should replace $address['myfieldlikeindatabase'] with a variable that contains the information you need. To receive the data, you can use the TYPO3 database API functions ($GLOBALS['TYPO3_DB']).
这篇关于tt_address:将地址类别添加到模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!