salut a tous
voila mon probleme
dans mon site d'annonce (
http://www.bretagneannonce.fr/ ) , en accedant aux offre , j'aimerai que le lecteur puisse voir apparaitre
dans la liste d'annonce le code postal ou la ville (comme le bon coin par exemple http://www.leboncoin.fr/annonces/offres/bretagne/ )
j'avoue je suis un peu perdu et je ne veux pas faire de C......e
quelqu'un a t'il une idee sur le sujet ?
ci joint une partie du code
//////////////////////////////////////////////////////
//Afficher les annonces trouvées /
//////////////////////////////////////////////////////
function display_search_annonces($array, $affich, $f)
{
?>
<!--espace-->
<table width="950" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="740" valign="top">
<table>
<tr>
<td height="5">
</td>
</tr>
</table>
<?php
foreach ( $array as $row )
{
$id = htmlentities($row['id_ann'], ENT_QUOTES);
$id_dep = htmlentities($row['id_dep'], ENT_QUOTES);
$titre = htmlentities($row['titre'], ENT_QUOTES);
$titre = stripslashes($titre);
if( strlen( $titre) > 42 )
{
$titre = substr($titre, 0, 42);
$pos = strrpos($titre, " ");
if( $pos )
{
$titre = substr($titre, 0, $pos);
}
$titre .= "...";
}
$date = htmlentities($row['date'], ENT_QUOTES);
$prix = htmlentities($row['prix'], ENT_QUOTES);
$prix = number_format($prix, 0,',',' ');
$dep_name = get_dep_name($id_dep);
$dep_name = stripslashes($dep_name);
$dep_name = htmlentities($dep_name, ENT_QUOTES);
$cat_id = $row['id_cat'];
$cat_name = get_cat_name($cat_id);
$cat_name = htmlentities($cat_name, ENT_QUOTES);
$cat_name = stripslashes($cat_name);
$images = get_images($id);
if( (count($images) != 0) && ($affich == 2) )
{
$image_name = "images_mini/".$images[0];
}
elseif( (count($images) != 0) && ($affich == 1) )
{
$image_name = "images/photo-y.jpg";
}
else
{
if( $affich == 2)
{
$image_name = "";
}
else
{
$image_name = "images/photo-n.gif";
}
}
$image_name = htmlentities($image_name, ENT_QUOTES);
//calcul de la date
$now = time();
$date_now = date('d', $now);
$moi_now = date('m', $now);
$date_ann = date('d', $date);
$moi_ann = date('m', $date);
if ( ($date_now == $date_ann) && ($moi_now - $moi_ann == 0 ) )
{
$hour = date('G', $date);
$min = date('i', $date);
$hour .= 'h'.$min;
$day = "Aujourd'hui ";
}
elseif( ($date_now - $date_ann == 1) && ($moi_now - $moi_ann == 0 ) )
{
$hour = date('G', $date);
$min = date('i', $date);
$hour .= 'h'.$min;
$day = "Hier ";
}
else
{
$month = date('d/m', $date);
$hour = date('G', $date);
$min = date('i', $date);
$hour .= 'h'.$min;
$day = '';
}
$hour = htmlentities($hour, ENT_QUOTES);
$day = htmlentities($day, ENT_QUOTES);
?>
<!--annonce-->
<?php if( $affich == 2 ) { ?>
<table width="740" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="55" height="60">
<?php
//affich = 2
if( !empty($day) )
{
echo $day."<br>"."à ".$hour;
}
else
{
echo "Le ".$month."<br>"." à ".$hour;;
}
?>
</td>
<td width="120" height="25" align="center" valign="bottom">
<?php
if ( !empty($image_name) )
{
echo "<a href=\"annonce-$id.htm\">
<img src=\"$image_name\" border=\"0\"></a>";
}
else
{
echo "<a href=\"annonce-$id.htm\">
<img src=\"images/no-photo.gif\" border=\"0\"></a>";
}
?>
</td>
<td width="280" height="25" valign="top">
<div style="padding-left: 8px;">
<?php
if( $f == 1 || $f == 2 )
{
echo "
<a href=\"annonce-$id-$f.htm\"
class=\"lien2\">$titre</a>";
}
else
{
echo "
<a href=\"annonce-$id.htm\" class=\"lien2\">$titre</a>";
}
?>
<br><br>
<?php
if( $prix != 0 )
{
echo $prix." €";
}
?>
</div>
</td>
<td width="60" height="50" align="right">
<div style="padding-left: 0px;">
</div>
</td>
<td width="100" height="50" valign="top">
<div style="padding-left: 15px;">
<?php echo $dep_name; ?>
</div>
</td>
<td width="140" height="50" valign="top">
<div style="padding-left: 15px;">
<?php echo $cat_name;?>
</div>
</td>
</tr>
</table>
<table width="740" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="20">
<img src="images/espace.gif">
</td>
</tr>
</table>
<?php } ?>
<!-- sans photos-->
<? if( $affich == 1) { ?>
<!--annonce-->
<table width="740" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="105" height="25">
<?php
//afffich = 1
if( !empty($day) )
{
echo $day."à ".$hour;
}
else
{
echo "Le ".$month." à ".$hour;
}
?>
</td>
<td width="30" height="25" align="center">
<?php echo "<img src=\"$image_name\">"; ?>
</td>
<td width="280" height="25">
<div style="padding-left: 8px;">
<?php
if( $f == 1 || $f == 2 )
{
echo "
<a href=\"annonce-$id-$f.htm\"
class=\"lien2\">$titre</a>";
}
else
{
echo "
<a href=\"annonce-$id.htm\" class=\"lien2\">$titre</a>";
}
?>
</div>
</td>
<td width="80" height="25" align="right">
<div style="padding-left: 0px;">
<?php
if( $prix != 0 )
{
echo $prix." €";
}
?>
</div>
</td>
<td width="105" height="25">
<div style="padding-left: 15px;">
<?php echo $dep_name; ?>
</div>
</td>
<td width="140" height="25">
<div style="padding-left: 15px;">
<?php echo $cat_name;?>
</div>
</td>
</tr>
</table>
<!--sans photos-->
<?php } ?>
<?php
}
}
//////////////////////////////////////////////////
//Afficher le nombre d'annonces trouvées , nombre/
//de particuliers et proffesionels /
//////////////////////////////////////////////////
function display_search_infos($array, $f, $limit, $page)
{
$total = htmlentities($array['total'], ENT_QUOTES);
$par = htmlentities($array['par'], ENT_QUOTES);
$pro = htmlentities($array['pro'], ENT_QUOTES);
$global = htmlentities($array['global'], ENT_QUOTES);
$limit = htmlentities($limit, ENT_QUOTES);
if( !empty($_SESSION['old_reg']) )
{
$reg = $_SESSION['old_reg'];
}
else
{
$reg = 0;
}
if( !empty($_SESSION['old_cat']) )
{
$cat = $_SESSION['old_cat'];
}
else
{
$cat = 0;
}
$reg_name = get_reg_name($reg);
$reg_name = htmlentities($reg_name, ENT_QUOTES);
$reg_name = stripslashes($reg_name);
$cat_name = get_cat_name($cat);
$cat_name = htmlentities($cat_name, ENT_QUOTES);
$cat_name = stripslashes($cat_name);
?>
<!--espace-->
<table width="950" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="950" height="7">
</td>
</tr>
</table>
<!--bar d'infos-->
<table width="950" align="center" style="BACKGROUND-IMAGE: url(images/espacehaut.gif)" cellpadding="0" cellspacing="0">
<tr>
<td width="650" height="24" valign="top">
<div style="padding-left: 2px; padding-top: 5px">
<?php if( $f == 1 || $f == 2 ){ ?>
<a href="recherche.php?l=1" class="lien2">
Toutes les annonces :</a>
<?php }else{ ?>
<a href="recherche.php?l=1" class="lien3">
Toutes les annonces :</a>
<?php } ?>
<?php
$deb = ($page*$limit)-$limit + 1;
$fin = $limit*$page;
if ( $f != 1 && $f != 2 )
{
echo "
$deb à $fin sur $total ";
}
else
{
echo "
$total ";
}
?>
<?php if( $f == 1 ){ ?>
<a href="recherche.php?l=1&f=1" class="lien3">
Particulier :</a>
<?php }else{ ?>
<a href="recherche.php?l=1&f=1" class="lien2">
Particulier :</a>
<?php } ?>
<?php
if( $f == 1 )
{
echo " $deb à $fin sur ".$par;
}
else
{
echo $par;
}
?>
<?php if( $f == 2 ){ ?>
<a href="recherche.php?l=1&&f=2" class="lien3">
Professionnel :</a>
<?php }else{ ?>
<a href="recherche.php?l=1&f=2" class="lien2">
Professionnel :</a>
<?php } ?>
<?php
if( $f == 2 )
{
echo " $deb à $fin sur ".$pro;
}
else
{
echo $pro;
}
?>
</div>
</td>
<td width="300" height="24" align="right" valign="top">
<div style="padding-right: 2px; padding-top: 5px">
<?php echo $global; ?> annonces sur tout le site
</div>
</td>
</tr>
</table>
<table width="950" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="650" valign="top">
<div style="padding-left: 1px; padding-top: 13px; padding-bottom: 5px;">
<strong>Vous êtes ici :</strong>
<?php
if( !empty($reg_name) )
{
echo "<a href=\"annonces.php?region=$reg\" class=\"lien2\">
$reg_name</a> - ";
}
else
{
echo "Toutes régions - ";
}
if( !empty($cat_name) )
{
echo "$cat_name";
}
else
{
echo "Toutes catégories";
}
?>
</div>
</td>
</tr>
<table>
<!--barre d'infos-->
<?php
}
function display_big_image_une($name, $array, $id, $id_image)
{
$name = htmlentities($name, ENT_QUOTES);
$path = "images_ann/$name";
$size = @getimagesize($path);
$width = $size[0];
$height = $size[1];
?>
<table width="485" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="485" height="373" align="center" valign="middle">
<div style="padding-top: 5px;">
<?php
$max_width = 480;
$max_height = 360;
// si l'image est trop large ou trop haute
if( $width < 200 && $height < 100 )
{
$max_width = $width * 2;
$max_height = $height * 2;
}
else
{
if($max_width && ($width > $height))
{
// image plus large que haute
$max_height = ( ($height * $max_width)/ $width );
$max_width = $max_width;
}
elseif($max_height && ($height > $width))
{
// image plus haute que large
$max_height = $max_height;
$max_width = ( ($width *$max_height) / $height );
}
else
{
$max_width = ( ($width *$max_height) / $height );
$max_height = ( ($height * $max_width)/ $width );
}
}
if( $max_width > 480 )
{
$max_width = 480;
}
if( $max_height > 360 )
{
$max_height = 360;
}
?>
<img src="<?php echo "images_ann/$name"; ?>" height="<?php echo $max_height; ?>" width="<?php echo $max_width; ?>" border="0">
</div>
</td>
</tr>
</table>
Afficher la suite