[Typo3-UG Oesterreich] texte verbinden -> Rollover Images

Hannes Maier h.maier at yama.at
Fri Jun 4 21:14:33 CEST 2004


hallo!

nachdem ichs nun doch irgendwie geschafft hab Rolloverimages zu erstellen,
poste ich das ergebnis (falls es jemanden interessiert):
das erste bild -> normal status
das zweite bild -> rollover status


******* TS-SETUP

includeLibs.user_makeRollover = media/scripts/user_makeRollover.php

marks.markername = IMAGE
marks.markername {
  file.import = uploads/pics/
  file.import.field = image
  file.import.listNum = 0
  wrap = |

  imageLinkWrap = 1
  imageLinkWrap {
  enable.field = image_link
  typolink.parameter.field = image_link
  typolink.target = {$styles.content.links.target}
  typolink.extTarget = {$styles.content.links.extTarget}
  typolink.userFunc = user_makeRollover->main
  }
}


***********************
*****user_makeRollover.php

class user_makeRollover {
 var $cObj;    // reference to the calling object.
 function main($content,$conf)    {
  global $TSFE;
  $this->conf=$conf;

  // get Images as array, 0=normalstatus, 1=rolloverstatus
  $user_makeRollover_Images =
t3lib_div::trimExplode(',',$this->cObj->data["image"],1);
  //debug ($user_makeRollover_Images);

  //Get rid off > in tag (last char)
  $content["TAG"] = substr($content["TAG"], 0, -1);

  // Insert imgname + Rolloverimagename
  // final tag:
onMouseOver="SwapImage('imgname','','Rolloverimagename',1);">
  $content["TAG"] .= " onMouseOut=\"SwapImgRestore();\"
onMouseOver=\"SwapImage('internal" .$this->cObj->data["uid"] .
"img','','uploads/pics/". $user_makeRollover_Images[1] . "',1);\">";

  return $content["TAG"];

 }

}

***********************
*****class.tslib_content.php  bei function cImage($file,$conf) (Zeile 2428):

original war:
$theValue = '<img '. $imageNameParam . '
src="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.t3lib_div::rawUrlEnco
deFP($info[3])).'" width="'.$info[0].'" height="'.$info[1].'"
border="'.intval($conf['border']).'"'.($conf['params']?'
'.$conf['params']:'').($altParam).' />';

von mir:
   $imageNameParama = t3lib_div::trimExplode(':',$this->currentRecord,1);
   $imageNameParam = "name=\"internal" . $imageNameParama[1] . "img\" ";
   $theValue = '<img '. $imageNameParam . '
src="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.t3lib_div::rawUrlEnco
deFP($info[3])).'" width="'.$info[0].'" height="'.$info[1].'"
border="'.intval($conf['border']).'"'.($conf['params']?'
'.$conf['params']:'').($altParam).' />';

***********************
lg
han





More information about the TYPO3-at mailing list