URL Rewriting

thenz Messages postés 1 Date d'inscription mardi 26 septembre 2006 Statut Membre Dernière intervention 4 février 2011 - 4 févr. 2011 à 19:27
vthenot Messages postés 1 Date d'inscription mercredi 12 mars 2008 Statut Membre Dernière intervention 17 février 2011 - 17 févr. 2011 à 15:47
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

2 réponses

romain14g59 Messages postés 74 Date d'inscription jeudi 5 janvier 2006 Statut Membre Dernière intervention 26 mai 2011
17 févr. 2011 à 11:21
Bonjour,

Je ne comprend pas exactement ton problème en gros l'url se génére mais il n'y a pas de valeur pour ton $dep?

Bonne journée
0
vthenot Messages postés 1 Date d'inscription mercredi 12 mars 2008 Statut Membre Dernière intervention 17 février 2011
17 févr. 2011 à 15:47
Bonjour,

Oui, c'est ça, je n'ai pas la valeur pour $dep.
Merci
0
Rejoignez-nous