![]() |
Форум больше не используется. Присоединяйтесь к каналу #community-ru в Slack for TYPO3 community |
|
|
#1 |
|
Administrator
|
Иногда нужны кастомные FCE для download section
вот пример (здесь вручную вставляется картинка для PDF файла, поскольку на продакшен сервере не работала нормально генерерация превью для PDF) Код:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3DataStructure>
<meta type="array">
<langDisable>1</langDisable>
</meta>
<ROOT type="array">
<tx_templavoila type="array">
<title>ROOT</title>
<description>Select the HTML element on the page which you want to be the overall container element for the template.</description>
</tx_templavoila>
<type>array</type>
<el type="array">
<field_subtitle type="array">
<tx_templavoila type="array">
<title>Subtitle</title>
<sample_data type="array">
<numIndex index="0"></numIndex>
</sample_data>
<eType>input</eType>
<TypoScript><![CDATA[
10 < lib.fce_title
10.wrap = <p class="file-title">|</p>
20 = TEXT
20 {
field = field_subtitle
required = 1
#typolink.parameter.field = field_file
wrap = <p class="file-subtitle">|</p>
}
30 = COA
30 {
wrap = <p class="file-filename">(|)</p>
10 = TEXT
10 {
field = field_file
postUserFunc = user_get_filename
}
}
}]]></TypoScript>
</tx_templavoila>
<TCEforms type="array">
<config type="array">
<type>input</type>
<size>48</size>
<eval>trim</eval>
</config>
<label>Subtitle</label>
</TCEforms>
</field_subtitle>
<field_file type="array">
<tx_templavoila type="array">
<title>File</title>
<sample_data type="array">
<numIndex index="0"></numIndex>
</sample_data>
<eType>link</eType>
<TypoScript><![CDATA[
10 = IMAGE
10.file = fileadmin/templates/img/icon_pdf.gif
10.stdWrap.typolink.parameter.current = 1
10.if.isTrue.field= field_file
10.wrap = |<br />
20 = COA
20.stdWrap.typolink.parameter.current = 1
20 {
30 = TEXT
30 {
# field = current
current = 1
postUserFunc = user_get_filedesc
}
} }]]></TypoScript>
</tx_templavoila>
<TCEforms type="array">
<config type="array">
<type>input</type>
<size>15</size>
<max>256</max>
<checkbox></checkbox>
<eval>trim</eval>
<wizards type="array">
<_PADDING type="integer">2</_PADDING>
<link type="array">
<type>popup</type>
<title>Link</title>
<icon>link_popup.gif</icon>
<script>browse_links.php?mode=wizard</script>
<JSopenParams>height=300,width=500,status=0,menubar=0,scrollbars=1</JSopenParams>
</link>
</wizards>
</config>
<label>File</label>
</TCEforms>
</field_file>
<field_zip type="array">
<tx_templavoila type="array">
<title>ZIP-file</title>
<sample_data type="array">
<numIndex index="0"></numIndex>
</sample_data>
<eType>link</eType>
<TypoScript><![CDATA[
10 = IMAGE
10.file = fileadmin/templates/img/icon_zip.gif
10.stdWrap.typolink.parameter.current = 1
10.wrap = |<br />
10.if.isTrue.field= field_zip
20 = COA
20.stdWrap.typolink.parameter.current = 1
20 {
30 = TEXT
30 {
current = 1
postUserFunc = user_get_filedesc
}
}
}]]></TypoScript>
</tx_templavoila>
<TCEforms type="array">
<config type="array">
<type>input</type>
<size>15</size>
<max>256</max>
<checkbox></checkbox>
<eval>trim</eval>
<wizards type="array">
<_PADDING type="integer">2</_PADDING>
<link type="array">
<type>popup</type>
<title>Link</title>
<icon>link_popup.gif</icon>
<script>browse_links.php?mode=wizard</script>
<JSopenParams>height=300,width=500,status=0,menubar=0,scrollbars=1</JSopenParams>
</link>
</wizards>
</config>
<label>ZIP-file</label>
</TCEforms>
</field_zip>
<field_image type="array">
<tx_templavoila type="array">
<title>Image</title>
<sample_data type="array">
<numIndex index="0"></numIndex>
</sample_data>
<eType>image</eType>
<TypoScript>
10 = IMAGE
10.file.import = uploads/tx_templavoila/
10.file.import.current = 1
10.file.import.listNum = 0
# 10.file.maxW = 200
10.stdWrap.typolink.parameter.field = field_file
10.stdWrap.if.isTrue.field= field_image
</TypoScript>
</tx_templavoila>
<TCEforms type="array">
<config type="array">
<type>group</type>
<internal_type>file</internal_type>
<allowed>gif,png,jpg,jpeg</allowed>
<max_size>1000</max_size>
<uploadfolder>uploads/tx_templavoila</uploadfolder>
<show_thumbs>1</show_thumbs>
<size>1</size>
<maxitems>1</maxitems>
<minitems>0</minitems>
</config>
<label>Image</label>
</TCEforms>
</field_image>
</el>
</ROOT>
</T3DataStructure>
PHP код:
Код:
# snippet by Pavel Antonov
tt_content.templavoila_pi1 {
10 = LOAD_REGISTER
10.fce_header.field = header
}
lib.fce_title = TEXT
lib.fce_title.data = register:fce_header
includeLibs.for_tv = fileadmin/templates/ts/user_func.php
Последний раз редактировалось Sergey M Nikitin; 28.05.2009 в 09:01 |
|
|
|
|
|
#2 |
|
Продвинутый
Регистрация: 03.02.2009
Сообщений: 57
|
Спасиб тебе Valery Romanchev!
Нужная тема. Повторил локально, всё получилось. Но удалённо неполучается. Не могу создать DS. TemplaVoila возвращает: Ошибка: Структура данных не определена в записи... (Отсутствует T3DataStructure XML?) А при попытке создать FCE: Data Structure ERROR: Line 80: Mismatched tag Вот думаю что я делаю не так
__________________
TYPO3 4.7.7 tt_news 3.4.0 rgmediaimages 2.8.4 rgmediaimagesttnews 1.0.3 ve_guestbook 2.12.0 |
|
|
|
![]() |
|
|
Похожие темы
|
||||
| Тема | Автор | Раздел | Ответов | Последнее сообщение |
| Как настроить RTE для FCE | Alexey Kuzminich | HTMLArea, RTE, tinymce_rte и другие визуальные редакторы | 2 | 29.08.2007 19:38 |
| wrap для одного из полей FCE элемента. | Tod | TypoScript практикум | 0 | 12.12.2006 15:35 |
| форма загрузки файлов | gulliver | TypoScript практикум | 3 | 28.09.2006 16:09 |
| Спмсок файлов для скачивания | Александр. | Общие вопросы | 2 | 16.01.2006 00:04 |
| Может кто подскажет...Проблема с размером скачиваемых файлов | Sergey | Общие вопросы | 5 | 14.01.2005 21:34 |