neues modul :: w3concepts.piconclick.v1
Verfasst: Do 11. Nov 2004, 15:20
hallo leute
ich habe für jemanden im forum dieses modul gemacht und möchte es nun zur disposition stellen.
vorübergehend ist es hier online:
http://452.w3concepts.net/cms/front_con ... p?idcat=50
es handelt sich dabei um ein einfaches bildmodul, welchem bis zu 10 kleine und dazugehörige grosse bilder übergeben werden können. die kleinen bilder werden dann über das eine grosse gelegt, wenn man darauf klickt.
insgesamt keine grosse sache, aber vielleicht ein anfang, falls jemand konkret ein solches oder ähnliches problem vorliegen hat.
ich habe nicht vor, das modul weiterzuentwickeln. es wird also bei dieser lösung bleiben, es sei denn, es nimmt sich einer von euch dem modul an.
gruss,
andreas
ich habe für jemanden im forum dieses modul gemacht und möchte es nun zur disposition stellen.
vorübergehend ist es hier online:
http://452.w3concepts.net/cms/front_con ... p?idcat=50
es handelt sich dabei um ein einfaches bildmodul, welchem bis zu 10 kleine und dazugehörige grosse bilder übergeben werden können. die kleinen bilder werden dann über das eine grosse gelegt, wenn man darauf klickt.
insgesamt keine grosse sache, aber vielleicht ein anfang, falls jemand konkret ein solches oder ähnliches problem vorliegen hat.
ich habe nicht vor, das modul weiterzuentwickeln. es wird also bei dieser lösung bleiben, es sei denn, es nimmt sich einer von euch dem modul an.
Code: Alles auswählen
<?php
class picOnClick {
function picOnClick() {
global $edit;
$this->setIniValues();
if ($edit) {
$this->showEditPics();
} else {
echo $this->getJsCode();
echo $this->getPics();
}
}
function setIniValues() {
$this->bild[0] =array("CMS_IMG[100]","CMS_IMGDESCR[100]","CMS_LINKDESCR[100]");
$this->bild[1] =array("CMS_IMG[101]","CMS_IMGDESCR[101]","CMS_LINKDESCR[101]");
$this->bild[2] =array("CMS_IMG[102]","CMS_IMGDESCR[102]","CMS_LINKDESCR[102]");
$this->bild[3] =array("CMS_IMG[103]","CMS_IMGDESCR[103]","CMS_LINKDESCR[103]");
$this->bild[4] =array("CMS_IMG[104]","CMS_IMGDESCR[104]","CMS_LINKDESCR[104]");
$this->bild[5] =array("CMS_IMG[105]","CMS_IMGDESCR[105]","CMS_LINKDESCR[105]");
$this->bild[6] =array("CMS_IMG[106]","CMS_IMGDESCR[106]","CMS_LINKDESCR[106]");
$this->bild[7] =array("CMS_IMG[107]","CMS_IMGDESCR[107]","CMS_LINKDESCR[107]");
$this->bild[8] =array("CMS_IMG[108]","CMS_IMGDESCR[108]","CMS_LINKDESCR[108]");
$this->bild[9] =array("CMS_IMG[109]","CMS_IMGDESCR[109]","CMS_LINKDESCR[109]");
$this->bild[10] =array("CMS_IMG[110]","CMS_IMGDESCR[110]","CMS_LINKDESCR[110]");
$this->bild[11] =array("CMS_IMG[111]","CMS_IMGDESCR[111]","CMS_LINKDESCR[111]");
$this->bild[12] =array("CMS_IMG[112]","CMS_IMGDESCR[112]","CMS_LINKDESCR[112]");
$this->bild[13] =array("CMS_IMG[113]","CMS_IMGDESCR[113]","CMS_LINKDESCR[113]");
$this->bild[14] =array("CMS_IMG[114]","CMS_IMGDESCR[114]","CMS_LINKDESCR[114]");
$this->bild[15] =array("CMS_IMG[115]","CMS_IMGDESCR[115]","CMS_LINKDESCR[115]");
$this->bild[16] =array("CMS_IMG[116]","CMS_IMGDESCR[116]","CMS_LINKDESCR[116]");
$this->bild[17] =array("CMS_IMG[117]","CMS_IMGDESCR[117]","CMS_LINKDESCR[117]");
$this->bild[18] =array("CMS_IMG[118]","CMS_IMGDESCR[118]","CMS_LINKDESCR[118]");
$this->bild[19] =array("CMS_IMG[119]","CMS_IMGDESCR[119]","CMS_LINKDESCR[119]");
$this->bild[20] =array("CMS_IMG[120]","CMS_IMGDESCR[120]","CMS_LINKDESCR[120]");
}
function showEditPics() {
foreach ($this->bild as $key => $bild) {
echo '<p>';
$key2 = floor($key / 2);
$key3 = $key / 2;
$gerade = ($key3 == $key2)?(true):(false);
if ($key == 0) {
echo '<div><strong>Grosses Bild (Anfangszustand):</strong></div>';
} elseif ($gerade) {
$bildnr = $key/2;
echo "<div>Bild Nr. $bildnr (gross)</div>";
} else {
$bildnr = floor($key/2) + 1;
echo "<div>Bild Nr. $bildnr (klein)</div>";
}
if ($bild[0] != "") echo "<div><img src=\"{$bild[0]}\" border=\"0\"></div>";
echo "{$bild[1]}";
echo "{$bild[2]}";
echo '</p>';
}
}
function getJsCode() {
$returnvalue = "
<script type=\"text/javascript\">
<!--
";
for ($i=2;$i<count($this->bild);$i=$i+2) {
$returnvalue .= $this->getJsCodeSnippet($i);
}
$returnvalue .= "
function picOnClick(Bildnr,Bildobjekt) {
Bildnr.src = Bildobjekt.src;
}
//-->
</script>
";
return $returnvalue;
}
function getJsCodeSnippet($i) {
if (empty($this->bild[$i][0])) return '';
$returnvalue = "
Bild$i = new Image();
Bild$i.src = \"{$this->bild[$i][0]}\";
";
return $returnvalue;
}
function getPics() {
$returnvalue = "<p><img src=\"{$this->bild[0][0]}\" name=\"picOnClickTarget\" /></p>\n";
$counter = 1;
for ($j=1;$j<3;$j++) {
$returnvalue .= "<p>\n";
for ($k=1;$k<6;$k++) {
$returnvalue .= $this->getImageCode($counter++);
$returnvalue .= " \n";
}
$returnvalue .= "</p>\n";
}
return $returnvalue;
}
function getImageCode($i) {
$index = $i*2;
if (empty($this->bild[$index-1][0])) return '';
$returnvalue = "<a href=\"javascript:picOnClick(picOnClickTarget,Bild$index)\"><img src=\"{$this->bild[$index-1][0]}\" border=\"0\" onClick=\"picOnClick(picOnClickTarget,Bild$index)\" /></a>";
return $returnvalue;
}
}
$picOnClick = new picOnClick();
?>
andreas