菜单

tca.inline.tt_content配置与读取

2010年05月5日 - typo3

TCA里:
‘config’ => array (
‘type’ => ‘inline’,
‘foreign_table’ => ‘tt_content’,
‘maxitems’ => 100,
‘appearance’ => array(
‘showSynchronizationLink’ => 0,
‘showAllLocalizationLink’ => 0,
‘showPossibleLocalizationRecords’ => 0,
‘showRemovedLocalizationRecords’ => 0,
‘expandSingle’ => 1
),
‘behaviour’ => array(
),
)
读取方法:
/**
* getTTContent form tt_content by id
* use different types ep: user text user_int
* @param pid is the id of tt_content
*/
function getTTContent($pid) {
$content = ”;
$pidArray = explode(‘,’,$pid);
if (empty($pidArray)) {return ”;}
foreach ($pidArray as $val) {
$res = $GLOBALS [‘TYPO3_DB’]->exec_SELECTquery ( ‘*’, ‘tt_content’, ‘deleted=0 and hidden=0 and uid=’.$val);
while ( false != ($row = $GLOBALS [‘TYPO3_DB’]->sql_fetch_assoc ( $res )) ) {
//方法一
/*
$rec = $this->pi_getRecord(‘tt_content’,$row[‘uid’],$checkPage=0);
$cObj = &t3lib_div::makeInstance(‘tslib_cObj’);
$cObj->start($rec,’tt_content’);
$content .= $cObj->cObjGetSingle(‘<‘ . ‘tt_content’, array());
*/
//方法二
$conf[‘tables’] = ‘tt_content’;
$conf[‘source’] = $row[‘uid’];
$conf[‘dontCheckPid’] = 1;
$content .= $this->cObj->cObjGetSingle(‘RECORDS’, $conf);
}
}
return $content;
}

http://typo3.org/documentation/document-library/core-documentation/doc_core_api/4.2.0/view/4/2/#id4431730

发表评论

电子邮件地址不会被公开。 必填项已用*标注