Zum Inhalt springen

Attribut Feld in DS setzen

Erstellt am 1. Februar 2008 · 3 Antworten · letzte Antwort am 6. März 2008

Tags: Frage

Jeff_s ·

Hallo,

Ich verzweifele so langsam beim Versuch ein Attribut Feld im TypoScript meiner DS zu setzten.

Also ich habe folgende Felder in meiner DS:

  • Attribut Feld -> Verbunden mit einem DIV element -> Eigenschaft ATTRIBUTE : "style"(=)
    Image Feld -> Kein Mapping

So das Bild möchte ich jetzt gerne als Background-image in das Attribut Feld setzen. Dafür habe ich den Test Code umgeschrieben und in mein TS in der DS eingefügt. Jedoch bekomme ich es nicht hin, dass das Bild angezeigt wird.

Test Code der Haupt TypoScript Template:

Wenn ich den Test Code in meine Haupt TypoScript Template schreibe dann wird das Style Attribut gesetzt.

lib.bgimage = TEXT
lib.bgimage.value = position:absolute;height:441px;width:441px;background:url(fileadmin/templates/main/images/layout/ct_box_clock.png) no-repeat;

Hier die DataStructure in XML Form:

<?xml version="1.0" encoding="iso-8859-1" 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_bgimage type="array">
				<type>attr</type>
				<tx_templavoila type="array">
					<title>Background Image</title>
					<description>Map this attribute with the style attribute of the html element containing the background image</description>
					<sample_data type="array">
						<numindex index="0"></numindex>
					</sample_data>
					<etype>TypoScriptObject</etype>
					<typoscriptobjpath>lib.bgimage</typoscriptobjpath>
				</tx_templavoila>
			</field_bgimage>
			<field_content type="array">
				<tx_templavoila type="array">
					<title>Content</title>
					<description>Map this element to the content element</description>
					<sample_data type="array">
						<numindex index="0">[Here goes my content. Here goes my content. Here goes my content. Here goes my content]</numindex>
					</sample_data>
					<etype>rte</etype>
					<typoscript><![CDATA[
	10 = TEXT
	10.current = 1
	10.parseFunc = < lib.parseFunc_RTE
							]]></typoscript>
					<oldstylecolumnnumber type="integer">0</oldstylecolumnnumber>
					<proc type="array">
						<hsc type="integer">0</hsc>
					</proc>
				</tx_templavoila>
				<tceforms type="array">
					<config type="array">
						<type>text</type>
						<cols>48</cols>
						<rows>5</rows>
						<softref>typolink_tag,images,email[subst],url</softref>
					</config>
					<label>Content</label>
					<defaultextras>richtext:rte_transform[flag=rte_enabled|mode=ts_css]</defaultextras>
				</tceforms>
			</field_content>
			<field_image1 type="array">
				<type>no_map</type>
				<tx_templavoila type="array">
					<title>Background 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


        Abgeänderter Code
        20 = TEXT
        20.text.field = field_bgimage 
	20.value = position:absolute;height:441px;width:441px;background:url(fileadmin/templates/main/images/layout/|) no-repeat;

</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>Background Image </label>
				</tceforms>
			</field_image1>
		</el>
	</root>
</t3datastructure>
Jeff_s ·

Lösung:

TS Code für das Attribut-Feld:

<TypoScript>
	<![CDATA[
  		10 = TEXT
		10.field = field_image1
		10.wrap = position:absolute;height:441px;width:441px;background:url(fileadmin/templates/main/images/layout/|) no-repeat;top:-30px;left:-30px;
	]]>
</TypoScript>

TS Code für das Bild-Feld:
Also hier muss im Grunde nur mein abgeänderter Code wieder raus

<TypoScript>
	<![CDATA[
        10 = IMAGE
        10.file.import = uploads/tx_templavoila/
        10.file.import.current = 1
        10.file.import.listNum = 0
	]]>
</TypoScript>
Arnie2001 ·
Jeff_s schrieb

Lösung:

TS Code für das Attribut-Feld:

<TypoScript>
	<![CDATA[
  		10 = TEXT
		10.field = field_image1
		10.wrap = position:absolute;height:441px;width:441px;background:url(fileadmin/templates/main/images/layout/|) no-repeat;top:-30px;left:-30px;
	]]>
</TypoScript>

TS Code für das Bild-Feld:
Also hier muss im Grunde nur mein abgeänderter Code wieder raus

<TypoScript>
	<![CDATA[
        10 = IMAGE
        10.file.import = uploads/tx_templavoila/
        10.file.import.current = 1
        10.file.import.listNum = 0
	]]>
</TypoScript>

Könntest du bitte mal den kompletten fertigen Code deiner XML-Datei posten?

Wäre echt nett von dir!

Gruß und Danke

Jeff_s ·
<?xml version="1.0" encoding="iso-8859-1" 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_bgimage type="array">
				<type>attr</type>
				<tx_templavoila type="array">
					<title>Background Image</title>
					<description>Map this attribute with the style attribute of the html element containing the background image</description>
					<sample_data type="array">
						<numIndex index="0"></numIndex>
					</sample_data>
					<eType>input</eType>
					<TypoScript>
						
							10 = TEXT
							10.field = field_image1
							10.wrap = position:absolute;height:441px;width:441px;background:url(uploads/tx_templavoila/|) no-repeat;top:-30px;left:-30px;
						
					</TypoScript>
				</tx_templavoila>
			</field_bgimage>
			<field_content type="array">
				<tx_templavoila type="array">
					<title>Content</title>
					<description>Map this element to the content element</description>
					<sample_data type="array">
						<numIndex index="0">[Here goes my content. Here goes my content. Here goes my content. Here goes my content]</numIndex>
					</sample_data>
					<eType>rte</eType>
					<TypoScript><![CDATA[
	10 = TEXT
	10.current = 1
	10.parseFunc = < lib.parseFunc_RTE
							]]></TypoScript>
					<oldStyleColumnNumber type="integer">0</oldStyleColumnNumber>
					<proc type="array">
						<HSC type="integer">0</HSC>
					</proc>
				</tx_templavoila>
				<TCEforms type="array">
					<config type="array">
						<type>text</type>
						<cols>48</cols>
						<rows>5</rows>
						<softref>typolink_tag,images,email[subst],url</softref>
					</config>
					<label>Content</label>
					<defaultExtras>richtext:rte_transform[flag=rte_enabled|mode=ts_css]</defaultExtras>
				</TCEforms>
			</field_content>
			<field_image1 type="array">
				<type>no_map</type>
				<tx_templavoila type="array">
					<title>Background 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
							</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>Background Image </label>
				</TCEforms>
			</field_image1>
			<field_header type="array">
				<tx_templavoila type="array">
					<title>Header</title>
					<sample_data type="array">
						<numIndex index="0">[Header]</numIndex>
					</sample_data>
					<eType>input</eType>
					<TypoScript>
						
							10 = TEXT
							10.data = register:tx_templavoila_pi1.parentRec.header
						
					</TypoScript>
					<proc type="array">
						<HSC type="integer">0</HSC>
					</proc>
				</tx_templavoila>
			</field_header>
		</el>
	</ROOT>
</T3DataStructure>

Bitte schön