[TYPO3-templavoila] TV Attribute mapping problem

Jacob Rasmussen jr at concare.net
Thu Oct 12 10:02:43 CEST 2006


Hi again,

> > I'm using TV 1.1.1 and I have a problem with attribute 
> mappings on a 
> > template... The template looks like this:
> > 
> > <div id="wrapper">
> > 	<div id="top_frame" style="... Some CSS styling goes here">
> > 		<a href="" id="weblink"></a>
> > 		<a href="" id="maillink"></a>
> > 	</div>
> > ...
> > 
> > Now my problem is that I map the attribute "style" on the 
> second DIV 
> > tag and I would also like to map the href attribute on the A tags.
> > If I only map the DIV or A attributes (I can map both A 
> attributes at 
> > the same time without troubles), there are no issues... But 
> when I try 
> > to map both the A attributes and the DIV attributes, TV drops the A 
> > attribute mappings (shows an exclamation point).
> 
> Impossible to comment without seeing DS and how you map.
> 
> > In an earlier version of the template I used a table instead of the 
> > divs, and I was able to map all attributes, but some strange code 
> > appeared in the template DS, namely the stdWrap which is 
> added below 
> > the image properties (I use typoscript to determine which 
> background 
> > image should be used). The two typolinks belong to my a 
> href mappings, 
> > and shouldn't have been mixed with the td mapping.
> 
> This TS code was there in all TV versions, even in 0.3.0.
> 

Sorry for the misunderstanding, what I meant was an earlier version of the template.. Not templavoila :-)

Old html template:
------------------

<body>    <---- Mapped as ROOT

<table border="0" cellpadding="0" cellspacing="0" id="wrapper" align="center">
	<tr>
		<td width="100%" height="152" valign="top" style="background-image: url(images/puma-banner.jpg);  background-position:top; background-repeat: no-repeat;" colspan="3">      <---- Mapped the style attribute to the DS topbanner field (ATTR:style)
			<div align="center">      <---- Mapped the element to the DS hovedmenu field (<div> INNER)
				<table border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td><img src="images/menu_l.gif" style="border:0px;height:22px;width:22px;" /></td>
						<td><img src="images/menu_r.gif" style="border:0px;height:22px;width:22px;" /></td>
					</tr>
				</table>
			</div>
			<a href="website URL" id="tms_alink"><span>Website</span></a>    <---- Mapped the href attribute to the DS website field (ATTR:href)
			<a href="mail URL" id="tms_maillink"><span>Mailadresse</span></a>    <---- Mapped the href attribute to the DS mail field (ATTR:href)
		</td>
	</tr>
</table>

Old template DS:
----------------

<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
<T3DataStructure>
	<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_hovedmenu type="array">
				<tx_templavoila type="array">
					<title>Hovedmenu</title>
					<sample_data type="array">
						<numIndex index="0"></numIndex>
					</sample_data>
					<eType>TypoScriptObject</eType>
					<eType_EXTRA type="array">
						<objPath>lib.layermenu</objPath>
					</eType_EXTRA>
					<TypoScriptObjPath>lib.layermenu</TypoScriptObjPath>
				</tx_templavoila>
			</field_hovedmenu>
			<field_topbanner type="array">
				<type>attr</type>
				<tx_templavoila type="array">
					<title>Top banner</title>
					<sample_data type="array">
						<numIndex index="0"></numIndex>
					</sample_data>
					<eType>image</eType>
					<TypoScript>
	10 = IMG_RESOURCE
	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_website
									
	10.stdWrap.typolink.parameter.field = field_mail
									</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>Top banner</label>
				</TCEforms>
			</field_topbanner>
			<field_website type="array">
				<type>attr</type>
				<tx_templavoila type="array">
					<title>Website link</title>
					<sample_data type="array">
						<numIndex index="0"></numIndex>
					</sample_data>
					<eType>link</eType>
					<TypoScript>
	10 = TEXT
	10.typolink.parameter.current = 1
	10.typolink.returnLast = url
							</TypoScript>
					<proc type="array">
						<HSC type="integer">1</HSC>
					</proc>
				</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>Website link</label>
				</TCEforms>
			</field_website>
			<field_mail type="array">
				<type>attr</type>
				<tx_templavoila type="array">
					<title>Mail link</title>
					<sample_data type="array">
						<numIndex index="0"></numIndex>
					</sample_data>
					<eType>link</eType>
					<TypoScript>
	10 = TEXT
	10.typolink.parameter.current = 1
	10.typolink.returnLast = url
							</TypoScript>
					<proc type="array">
						<HSC type="integer">1</HSC>
					</proc>
				</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>Mail link</label>
				</TCEforms>
			</field_mail>
		</el>
	</ROOT>
	<meta type="array">
		<langDisable type="integer">0</langDisable>
	</meta>
</T3DataStructure>

New html template:
------------------

<body>   <---- Mapped as ROOT

<div id="wrapper">
	<div id="top_frame" style="background-image: url(images/puma-banner.jpg);  background-position:top; background-repeat: no-repeat;">    <---- Mapped the style attribute to the DS topbanner field (ATTR:style)
		<div align="center">    <---- Mapped the element to the DS hovedmenu field (<div> INNER)
			<table border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td><img src="images/menu_l.gif" style="border:0px;height:22px;width:22px;" /></td>
					<td><img src="images/menu_r.gif" style="border:0px;height:22px;width:22px;" /></td>
				</tr>
			</table>
			<a href="http://www.tms-ringsted.dk" id="tms_alink"><span>Website</span></a>     <---- Tried mapping href attribute to DS weblink field ( error: a#tms_alink/ATTR:href )
			<a href="mailto:admin at test.dk" id="tms_maillink"><span>Mailadresse</span></a>    <---- Tried mapping href attribute to DS maillink field ( error: a#tms_maillink/ATTR:href )
		</div>
	</div>
</div>

New template DS:
----------------

<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
<T3DataStructure>
	<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_hovedmenu type="array">
				<tx_templavoila type="array">
					<title>Hovedmenu</title>
					<sample_data type="array">
						<numIndex index="0"></numIndex>
					</sample_data>
					<eType>TypoScriptObject</eType>
					<eType_EXTRA type="array">
						<objPath>lib.layermenu</objPath>
					</eType_EXTRA>
					<TypoScriptObjPath>lib.layermenu</TypoScriptObjPath>
				</tx_templavoila>
			</field_hovedmenu>
			<field_topbanner type="array">
				<type>attr</type>
				<tx_templavoila type="array">
					<title>Top banner</title>
					<sample_data type="array">
						<numIndex index="0"></numIndex>
					</sample_data>
					<eType>image</eType>
					<TypoScript>
	10 = IMG_RESOURCE
	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_weblink
									
	10.stdWrap.typolink.parameter.field = field_maillink
									</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>Top banner</label>
				</TCEforms>
			</field_topbanner>
			<field_left type="array">
				<tx_templavoila type="array">
					<title>Venstre kolonne</title>
					<sample_data type="array">
						<numIndex index="0">Venstre kolonne</numIndex>
					</sample_data>
					<eType>ce</eType>
					<TypoScript>
	10= RECORDS
	10.source.current=1
	10.tables = tt_content
	10.wrap = &lt;!--TYPO3SEARCH_begin--&gt; | &lt;!--TYPO3SEARCH_end--&gt;
                    </TypoScript>
					<oldStyleColumnNumber type="integer">0</oldStyleColumnNumber>
				</tx_templavoila>
				<TCEforms type="array">
					<config type="array">
						<type>group</type>
						<internal_type>db</internal_type>
						<allowed>tt_content</allowed>
						<size>5</size>
						<maxitems>200</maxitems>
						<minitems>0</minitems>
						<multiple>1</multiple>
						<show_thumbs>1</show_thumbs>
					</config>
					<label>Venstre kolonne</label>
				</TCEforms>
			</field_left>
			<field_main type="array">
				<tx_templavoila type="array">
					<title>Hovedkolonne</title>
					<sample_data type="array">
						<numIndex index="0">Brødtekst</numIndex>
					</sample_data>
					<eType>ce</eType>
					<TypoScript>
	10= RECORDS
	10.source.current=1
	10.tables = tt_content
	10.wrap = &lt;!--TYPO3SEARCH_begin--&gt; | &lt;!--TYPO3SEARCH_end--&gt;
                    </TypoScript>
					<oldStyleColumnNumber type="integer">1</oldStyleColumnNumber>
				</tx_templavoila>
				<TCEforms type="array">
					<config type="array">
						<type>group</type>
						<internal_type>db</internal_type>
						<allowed>tt_content</allowed>
						<size>5</size>
						<maxitems>200</maxitems>
						<minitems>0</minitems>
						<multiple>1</multiple>
						<show_thumbs>1</show_thumbs>
					</config>
					<label>Hovedkolonne</label>
				</TCEforms>
			</field_main>
			<field_right type="array">
				<tx_templavoila type="array">
					<title>Højre kolonne</title>
					<sample_data type="array">
						<numIndex index="0">Højre kolonne</numIndex>
					</sample_data>
					<eType>ce</eType>
					<TypoScript>
	10= RECORDS
	10.source.current=1
	10.tables = tt_content
	10.wrap = &lt;!--TYPO3SEARCH_begin--&gt; | &lt;!--TYPO3SEARCH_end--&gt;
                    </TypoScript>
					<oldStyleColumnNumber type="integer">2</oldStyleColumnNumber>
				</tx_templavoila>
				<TCEforms type="array">
					<config type="array">
						<type>group</type>
						<internal_type>db</internal_type>
						<allowed>tt_content</allowed>
						<size>5</size>
						<maxitems>200</maxitems>
						<minitems>0</minitems>
						<multiple>1</multiple>
						<show_thumbs>1</show_thumbs>
					</config>
					<label>Højre kolonne</label>
				</TCEforms>
			</field_right>
			<field_weblink type="array">
				<type>attr</type>
				<tx_templavoila type="array">
					<title>Weblink</title>
					<sample_data type="array">
						<numIndex index="0"></numIndex>
					</sample_data>
					<eType>link</eType>
					<TypoScript>
	10 = TEXT
	10.typolink.parameter.current = 1
	10.typolink.returnLast = url
							</TypoScript>
					<proc type="array">
						<HSC type="integer">1</HSC>
					</proc>
				</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>Weblink</label>
				</TCEforms>
			</field_weblink>
			<field_maillink type="array">
				<type>attr</type>
				<tx_templavoila type="array">
					<title>Maillink</title>
					<sample_data type="array">
						<numIndex index="0"></numIndex>
					</sample_data>
					<eType>link</eType>
					<TypoScript>
	10 = TEXT
	10.typolink.parameter.current = 1
	10.typolink.returnLast = url
							</TypoScript>
					<proc type="array">
						<HSC type="integer">1</HSC>
					</proc>
				</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>Maillink</label>
				</TCEforms>
			</field_maillink>
		</el>
	</ROOT>
</T3DataStructure>


-----------------------

I hope this is sufficient data to give an idea of the problem. The main reason why I'm moving from a table structure to DIVs is because the table layout breaks when I try to add additional content - and the DIVs don't.

Does it mean that much to map attributes in DIVs instead of TDs... Or is the problem due to nested mappings?
In both the old and new DS, it tries to wrap two typolinks (one from each of my link fields) on the image attribute.


Kind regards

Jacob Rasmussen



More information about the TYPO3-project-templavoila mailing list