Page 1 sur 1

fier breton

Posté : mer. oct. 05, 2005 2:45 pm
par Philippe GUEGAN
Voilà j'ai réussi à faire ce que je voulais, tu ouvre la fiche d'une maison, la première photo apparaît en grand, et les autres (ainsi que la première d'ailleurs, c'est logique,) apparaissent en vignette.
Il suffit de clique sur les vignettes pour remplacer la grande photo par celle que tu cliques
J'y ai passé du temps mais je suis content de m'être débrouillé.
Je n'ai trouvé sur aucun forum un code permettant de faire ça

Voilà à plus
Je vous passe le code pour diffuser dans le monde entier jusqu'au ciel:

<?php /* Date de création: 23/07/05 */
include_once ("globals.inc.php");
include_once ("fonctions.inc.php");
mysql_connect($serveur,$login,$motpasse) or die ("erreur de connexion au serveur ".mysql_error());
mysql_select_db($base) or die ("erreur de connexion a la base de données ".mysql_error());
?>
<html>

<body>

<?php
echo $_GET['trans'];
$id=$_GET['trans'];
$ida="a" ;
$idb="b";
$idc="c";
$idd="d";
$ide="e";
$filenam = "../photos/photofr/i$id.jpg";
$filenama= "../photos/photofr/i$id$ida.jpg";
$filenamb= "../photos/photofr/i$id$idb.jpg";
$filenamc= "../photos/photofr/i$id$idc.jpg";
$filenamd= "../photos/photofr/i$id$idd.jpg";
$filename= "../photos/photofr/i$id$ide.jpg";





echo ("<img alt = \"\" name=\"img01\" img src=\"$filenam\" border=\"0\" width=\"307\" height=\"230\" alt=\"\" onLoad=\"TempImage00=new Image(0,0); TempImage00.src=firstImage00\"></a><br>");
if (file_exists($filenam))

{
echo("<script language=\"JavaScript\">firstImage00='../photos/photofr/i$id.jpg';</script>");
echo ("<a href=\"#img01\" onclick=\"{OrigImage00=img00.src; img01.src=firstImage00}\">");
echo ("<img alt=\"\" name=\"img00\" border=\"0\" width=\"153\" height=\"115\"src=\"../photos/photofr/i$id.jpg\" onLoad=\"TempImage00=new Image(0,0); TempImage00.src=firstImage00\"></a>");
}
if (file_exists($filenama))
{
echo("<script language=\"JavaScript\">SecondImage00='../photos/photofr/i$id$ida.jpg';</script>");
echo ("<a href=\"#img01\" onclick=\"{OrigImage00=img00.src; img01.src=SecondImage00}\">");
echo ("<img alt=\"\" name=\"img00\" border=\"0\" width=\"153\" height=\"115\"src=\"../photos/photofr/i$id$ida.jpg\" onLoad=\"TempImage00=new Image(0,0); TempImage00.src=SecondImage00\"></a>");
}
if (file_exists($filenamb))
{
echo("<script language=\"JavaScript\">thirdImage00='../photos/photofr/i$id$idb.jpg';</script>");
echo ("<a href=\"#img01\" onclick=\"{OrigImage00=img00.src; img01.src=thirdImage00}\">");
echo ("<img alt=\"\" name=\"img00\" border=\"0\" width=\"153\" height=\"115\"src=\"../photos/photofr/i$id$idb.jpg\" onLoad=\"TempImage00=new Image(0,0); TempImage00.src=thirdImage00\"></a>");
}
if (file_exists($filenamc))
{
echo("<script language=\"JavaScript\">forthImage00='../photos/photofr/i$id$idc.jpg';</script>");
echo ("<a href=\"#img01\" onclick=\"{OrigImage00=img00.src; img01.src=forthImage00}\">");
echo ("<img alt=\"\" name=\"img00\" border=\"0\" width=\"153\" height=\"115\"src=\"../photos/photofr/i$id$idc.jpg\" onLoad=\"TempImage00=new Image(0,0); TempImage00.src=forthImage00\"></a>");
}
if (file_exists($filenamd))
{
echo("<script language=\"JavaScript\">fifthImage00='../photos/photofr/i$id$idd.jpg';</script>");
echo ("<a href=\"#img01\" onclick=\"{OrigImage00=img00.src; img01.src=fifthImage00}\">");
echo ("<img alt=\"\" name=\"img00\" border=\"0\" width=\"153\" height=\"115\"src=\"../photos/photofr/i$id$idd.jpg\" onLoad=\"TempImage00=new Image(0,0); TempImage00.src=fifthImage00\"></a>");
}
if (file_exists($filename))
{
echo("<script language=\"JavaScript\">sixthImage00='../photos/photofr/i$id$ide.jpg';</script>");
echo ("<a href=\"#img01\" onclick=\"{OrigImage00=img00.src; img01.src=sixthImage00}\">");
echo ("<img alt=\"\" name=\"img00\" border=\"0\" width=\"153\" height=\"115\"src=\"../photos/photofr/i$id$ide.jpg\" onLoad=\"TempImage00=new Image(0,0); TempImage00.src=sixthImage00\"></a>");
}
echo("<br>");
$query = " SELECT * FROM `biens_fr` WHERE(ref)= '$id'";
$result = mysql_query($query) or die ("Requête incorrecte ".mysql_error());
while($row = mysql_fetch_array($result))
{
echo("$row[desc]");
}
?>
</body>
</html>


:D

Philippe
:new_ukliam2:

Posté : mer. oct. 05, 2005 2:55 pm
par Régis
Est il possible de tester ?
Ou te reserves tu pour nous le presenter le 21 octobre.
Régis