Bonjour,
J'ai un petit pb avec mes fonctions URL rewriting.
Cela fonctionne avec une requête simple :
search-results.php?id_departement=".$id_departement."&dep=".$dep;
J'obtiens bien :
french-property-for-sale-or-rent-in-alpes-maritimes,108,0.php
mais pas avec les 2 requêtes combinées :
search-results.php?id_categorie=3&id_departement=".$id_departement."&dep=".$dep;
(Je perds ma variable département).
Pouvez-vous m'aider ?
Voici les codes de mes fonctions :
/// -------------------------------------- ///
function URL_Annonces_Categorie($id_categorie,$dep,$langue='fr') {
global $isLocal;
global $table;
//$isLocal = false;
//echo 'id_cat='.$id_categorie.', dep='.$dep.', lg='.$langue;
if ($isLocal) {
switch ($langue) {
case 'fr' :
$retour = "resultats-annonces.php?id_categorie=".$id_categorie."&dep=".$dep;
break;
case 'en' :
$retour = "search-results.php?id_categorie=".$id_categorie."&dep=".$dep;
break;
}
}
else {
$Req1 = "SELECT * FROM $table->categories WHERE id_categorie='"
.$id_categorie."'";
$Rst1 = mysql_query($Req1);
//echo $Req1.$Rst1;
$C = mysql_fetch_assoc($Rst1);
switch ($langue) {
case 'fr' :
$retour = "annonces-immo-".$C['cat_nom_'.$langue];
break;
case 'en' :
$retour = "real-estate-".$C['cat_nom_'.$langue];
break;
}
$retour = strtolower($retour);
while (strpos($retour,' ')!==FALSE) {
$retour = str_replace(" ","-",$retour);
}
$retour = Sans_Accent(str_replace(" ","-",$retour));
while (strpos($retour,'--')!==FALSE) {
$retour = str_replace("--","-",$retour);
}
$retour = substr($retour,0,170);
/*
$retour.= ",".$id_client.".php";
if ($id_annonce) $retour.= "?id_annonce=".$id_annonce;*/
$retour.= ",".$id_categorie;
$retour.= ",".$dep."";
$retour.= '.php';
}
return $retour;
}
/// -------------------------------------- ///
/// -------------------------------------- ///
function URL_Annonces_Departement($id_departement,$dep,$langue='fr') {
global $isLocal;
global $table;
//$isLocal = false;
//echo 'id_cat='.$id_categorie.', dep='.$dep.', lg='.$langue;
if ($isLocal) {
switch ($langue) {
case 'fr' :
$retour = "resultats-annonces.php?id_departement=".$id_departement."&dep=".$dep;
break;
case 'en' :
$retour = "search-results.php?id_departement=".$id_departement."&dep=".$dep;
break;
}
}
else {
$Req1 = "SELECT * FROM $table->departements WHERE id_departement='"
.$id_departement."'";
$Rst1 = mysql_query($Req1);
//echo $Req1.$Rst1;
$R = mysql_fetch_assoc($Rst1);
switch ($langue) {
case 'fr' :
$retour = "annonces-immo-departement-".$R['departement_nom_fr'];
break;
case 'en' :
$retour = "french-property-for-sale-or-rent-in-".$R['departement_nom_fr'];
break;
}
$retour = strtolower($retour);
while (strpos($retour,' ')!==FALSE) {
$retour = str_replace(" ","-",$retour);
}
$retour = Sans_Accent(str_replace(" ","-",$retour));
while (strpos($retour,'--')!==FALSE) {
$retour = str_replace("--","-",$retour);
}
$retour = substr($retour,0,170);
/*
$retour.= ",".$id_client.".php";
if ($id_annonce) $retour.= "?id_annonce=".$id_annonce;*/
$retour.= ",".$id_departement;
$retour.= ",".$dep."";
$retour.= '.php';
}
return $retour;
}
MERCI