最後我得到了這個問題的解決方案。
轉到您的擴展,並按照步驟 -
/Classes/Domain/Model/YourModel.php
/**
* yourPictures
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
* @lazy
*/
protected $yourPictures = NULL;
/**
* Constructor
*
* @return AbstractObject
*/
public function __construct() {
// ObjectStorage is needed to reference multiple files to one field
// see also @var before variable and @return before the respective get() method
$this->yourPictures = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
}
/**
* returns yourPictures
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
*/
public function getYourPictures() {
return $this->yourPictures;
}
/**
* sets yourPictures
*
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $yourPictures
* @return void
*/
public function setYourPictures($yourPictures) {
$this->yourPictures = $yourPictures;
}
/Configuration/TCA/YourModel.php
在array 'types'
和array 'columns'
中添加字段名稱,請添加 -
'your_pictures' => array(
'exclude' => 1,
'label' => 'LLL:EXT:your_ext/Resources/Private/Language/locallang_db.xlf:tx_yourext_domain_model_yourmodel.your_pictures',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'yourPictures',
array('minitems'=>0,'maxitems'=>10),
$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
),
),
- /ext_tables.sql
添加my_pictures varchar(255) DEFAULT '' NOT NULL,
- 爲了在流體模板顯示 -
<f:for each="{yourDomain.myPictures}" as="pic">
<f:image src="{pic.originalResource.publicUrl}" alt="{pic.originalResource.alternative}" title="{pic.originalResource.title}" ></f:image>
{pic.originalResource.description}
</f:for>
那就是它!希望它能幫助別人。
謝謝
如果鏈接失效,您可以在*您的回答中發佈鏈接*的相關部分嗎?非常感謝, –
@WaiHaLee我編輯了上面的答案。現在你可以相關的答案。 謝謝 – vids1229
非常感謝。 多圖像在TYPO3上完美運行7.6.10 它幫助了很多! –