[TYPO3-ttnews] Two image fields

Unai Aizpurua unai at alambre.net
Wed Jul 11 11:39:54 CEST 2007


Hi All,

I'm trying to add a secondary Image field in tt_news because their must 
appear in different place of the normal ones.
I created it with kickstarted and the edition goes right.

But I don't know if using user_imageMarkerFunc can put them of single 
view of tt_news.

As user_imageMarkerFunc process all the image markers I supossed that I 
must modify something there, somethin like:


function user_imagenMarkerFunc($paramArray,$conf){

	$markerArray = $paramArray[0];
	$lConf = $paramArray[1];
     $pObj = &$conf['parentObj']; // make a reference to the parent-object
	$row = $pObj->local_cObj->data;

	$imageNum = isset($lConf['imageCount']) ? $lConf['imageCount']:1;
	$imageNum = t3lib_div::intInRange($imageNum, 0, 100);
	$theImgCode = '';
	$imgs = t3lib_div::trimExplode(',', $row['image'], 1);
	$imgsCaptions = explode(chr(10), $row['imagecaption']);
	reset($imgs);
	$cc = 0;

	while (list(, $val) = each($imgs)) {
		if ($cc == $imageNum) break;
		if ($val) {
		 	$lConf['image.']['altText'] = ''; // reset altText
			$lConf['image.']['altText'] = $lConf['image.']['altText']; // set 
altText to value from TS
			$lConf['image.']['file'] = 'uploads/pics/'.$val;
			switch($lConf['imgAltTextField']) {
				case 'image':
					$lConf['image.']['altText'] .= $val;
				break;
				case 'imagecaption':
					$lConf['image.']['altText'] .= $imgsCaptions[$cc];
				break;
				default:
					$lConf['image.']['altText'] .= $row[$lConf['imgAltTextField']];
			}
		}
		$theImgCode .= 
$pObj->local_cObj->wrap($pObj->local_cObj->IMAGE($lConf['image.']).$pObj->local_cObj->stdWrap($imgsCaptions[$cc], 
$lConf['caption_stdWrap.']),$lConf['imageWrapIfAny_'.$cc]);
		$cc++;
	}
	$markerArray['###NEWS_IMAGE###'] = '';
	if ($cc) {
		$markerArray['###NEWS_IMAGE###'] = 
$pObj->local_cObj->wrap(trim($theImgCode), $lConf['imageWrapIfAny']);

	}
	$markerArray['###NEWS_IMAGE2###'] = '';
	if ($cc) {
		$markerArray['###NEWS_IMAGE2###'] = 
$pObj->local_cObj->wrap(trim($theImgCode), $lConf['imageWrapIfAny']);

	}
		return $markerArray;


Someone has an idea?

Regards!



More information about the TYPO3-project-tt-news mailing list