[TYPO3-templavoila] FCE - link images to header_link

Ian Solo ian at webian.it
Mon Dec 1 13:12:59 CET 2008


Hello!

At the moment I have an FCE with the DS listed as [1] at the bottom of 
this post.

There's a field_image (where I load the image) and a field_linkurl 
(where I set the link for the image). The field_header is taken from the 
tt_content header.

It works but I need to eliminate the field_linkurl and link the image to 
the link of the tt_content header. So I don't have to set the link twice 
(in field_linkurl and in header_link).

The typoscript of the field_image is listed as [2]. What the TS do is:
1. get images (DAM images)
2. set the alt parameters of the images to field_caption
3. set the links of the images to zoom with Lightbox
4. override the links with the field_linkurl (if set)
5. set the title of the links to field_caption

I guess that I need to change point 4. to something like:
parameter.override.field.data = 
register:tx_templavoila_pi1.parentRec.header_link

but it doesn't work and I can't figure out where I'm wrong.

Any hint?
Cheer!ian

[1] DS of the FCE
------------------------------------------------------------------------
<?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_header type="array">
				<tx_templavoila type="array">
					<title>Header</title>
					<sample_data type="array">
						<numIndex index="0"></numIndex>
					</sample_data>
					<eType>TypoScriptObject</eType>
					<TypoScriptObjPath>lib.fceheader</TypoScriptObjPath>
				</tx_templavoila>
			</field_header>
			<field_bodytext type="array">
				<tx_templavoila type="array">
					<title>Bodytext</title>
					<sample_data type="array">
						<numIndex index="0"></numIndex>
					</sample_data>
					<eType>text</eType>
					<TypoScript>
						<![CDATA[
							10 = TEXT
							10.current = 1
							10.parseFunc = < lib.parseFunc_RTE
						]]>
					</TypoScript>					
					<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>
					</config>
					<label>Bodytext</label>
					<defaultExtras>richtext[*]:rte_transform[mode=css]</defaultExtras>
				</TCEforms>
			</field_bodytext>
			<field_image type="array">
                 <tx_templavoila type="array">
                     <title>Image</title>
					<sample_data type="array">
						<numIndex index="0"></numIndex>
					</sample_data>
                     <eType>TypoScriptObject</eType>
                     <eType_EXTRA type="array">
                         <objPath>lib.fce_dam_image</objPath>
                     </eType_EXTRA>
 
<TypoScriptObjPath>lib.fce_dam_image</TypoScriptObjPath>
                 </tx_templavoila>
				<TCEforms type="array">
					<config type="array">
						<form_type>user</form_type>
					 
<userFunc><![CDATA[EXT:dam/lib/class.tx_dam_tcefunc.php:&tx_dam_tceFunc->getSingleField_typeMedia]]></userFunc>
						<type>group</type>
						<internal_type>db</internal_type>
						<allowed>tx_dam</allowed>
						<prepend_tname type="integer">1</prepend_tname>
						<MM>tx_dam_mm_ref</MM>
						<MM_foreign_select type="integer">1</MM_foreign_select>
						<MM_opposite_field>file_usage</MM_opposite_field>
						<MM_match_fields type="array">
							<ident>field_image</ident>
						</MM_match_fields>
						<allowed_types>gif,png,jpg,jpeg</allowed_types>
						<max_size>1000</max_size>
						<show_thumbs>1</show_thumbs>
						<size>5</size>
						<maxitems type="integer">200</maxitems>
						<minitems type="integer">0</minitems>
						<autoSizeMax type="integer">30</autoSizeMax>
					</config>
					<label>Image</label>
				</TCEforms>
             </field_image>
			<field_caption type="array">
				<type>no_map</type>
				<tx_templavoila type="array">
					<title>Image caption</title>
					<sample_data type="array">
						<numIndex index="0"></numIndex>
					</sample_data>
					<eType>input</eType>
					<proc type="array">
						<HSC type="integer">1</HSC>
					</proc>
				</tx_templavoila>
				<TCEforms type="array">
					<config type="array">
						<type>text</type>
						<cols>48</cols>
						<rows>5</rows>
					</config>
					<label>Image caption</label>
				</TCEforms>
			</field_caption>
			<field_enlarge type="array">
				<type>no_map</type>
				<tx_templavoila type="array">
					<title>Zoom</title>
					<sample_data type="array">
						<numIndex index="0"></numIndex>
					</sample_data>
					<eType>int</eType>
				</tx_templavoila>
				<TCEforms type="array">
					<config type="array">
						<type>check</type>
						<eval>int</eval>
						<default type="integer">1</default>
					</config>
					<label>Zoom</label>
				</TCEforms>
			</field_enlarge>
			<field_linktitle type="array">
				<tx_templavoila type="array">
					<title>Link Title</title>
					<sample_data type="array">
						<numIndex index="0"></numIndex>
					</sample_data>
					<eType>input</eType>
					<proc type="array">
						<HSC type="integer">1</HSC>
					</proc>
				</tx_templavoila>
				<TCEforms type="array">
					<config type="array">
						<type>input</type>
						<size>48</size>
						<eval>trim</eval>
					</config>
					<label>Link Title</label>
				</TCEforms>
			</field_linktitle>
			<field_linkurl type="array">
				<type>attr</type>
				<tx_templavoila type="array">
					<title>Link URL</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
						10.typolink.required = 1
					</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>Link URL</label>
				</TCEforms>
			</field_linkurl>
		</el>
	</ROOT>
</T3DataStructure>
------------------------------------------------------------------------

[2] Typoscript of the field_image
------------------------------------------------------------------------
lib.fce_dam_image < tt_content.image.20

lib.fce_dam_image {
	imgList.cObject {
		refField = field_image
		userFunc = tx_damtvc_tsfe->fetchFileList
	}
	1 {
		altText.field = field_caption
	  	altText.split.token.char = 10
		altText.split.returnKey.data = register : IMAGE_NUM_CURRENT
		
	    imageLinkWrap >
	    imageLinkWrap = 1
	    imageLinkWrap {
	    	enable.field = field_enlarge
			
	        typolink {
				parameter.cObject = IMG_RESOURCE
				parameter.cObject.file.import.data = TSFE:lastImageInfo|origFile

				parameter.override.field = field_linkurl
				parameter.override.listNum.stdWrap.data = register : IMAGE_NUM_CURRENT
				parameter.override.if.isTrue.field = field_linkurl

				title.field = field_caption
				title.split.token.char = 10
				title.split.returnKey.data = register : IMAGE_NUM_CURRENT

				ATagParams.data = register : tx_templavoila_pi1.parentRec.uid
				ATagParams.wrap = rel="lightbox[|]" class="lightbox"
				ATagParams.insertData = 1
				ATagParams.if.isTrue.field = field_enlarge
	        }
	    }
	}
	caption {
		1 = TEXT
		1 {
			field = field_caption
		}
	}
}
------------------------------------------------------------------------


More information about the TYPO3-project-templavoila mailing list