par
yoann38 » 06 nov. 2015, 19:35
Je ne vois pas le problème j'ai continuer a chercher, une fois dedirigé sur la bonne page grace à l'url rewrite
127.0.0.1/lasortie/annonce_zoom.php?id=434502 devient
http://127.0.0.1/lasortie/la-grande-sop ... mon/434502
Une fois dans la page redirigé mes liens déconne car il garde en parametre l'url
Si je clique sur une autre annonce il garde le parametre en compte pour l'exemple:
http://127.0.0.1/lasortie/la-grande-sop ... mon/434502
si je clique sur une autre annonce :
Je me trouve sur la page
http://127.0.0.1/lasortie/bourse-vetements/424157
je clique sur une autre annonce le lien devrait juste changer de titre et de id, la nan il le rajotue après et l'url devient
http://127.0.0.1/lasortie/bourse-veteme ... din/424352
Le code qui m'affiche les annonces:
<?php
//Selection de l'annonce
$sql = ("SELECT * FROM loisirs WHERE id_loisirs = ".$_GET['id']." AND valide = 1");
$id = $_GET["id"];
$req = $bdd->query($sql);
$row = $req->fetch() ;
$req->closeCursor();
if($row["url_rewrite"]!=$row["url_rewrite"]) {
header("location:".$row["url_rewrite"]."/".$row["id_loisirs"]);
}
// Suite du code et plus loin on affiches les annonces
<?php
$pub = "SELECT * FROM loisirs WHERE `id_type_loisirs` = $type AND `loisirs`.`date_fin_sortie` > NOW() and id_departements = $departement ";
$pub .= " ORDER BY id_loisirs DESC LIMIT 0, 5";
$req = $bdd->query($pub);
if($req->rowCount() > 0) {
while($ligne = $req->fetch(PDO::FETCH_ASSOC)){
$image = !empty($ligne['photo']) && file_exists($path.'img/annonce/600/'.$ligne['photo']) ? 'img/annonce/600/'.$ligne['photo'] : 'img/remplacement/'.simplification($aLoisirs[$ligne['id_type_loisirs']]).'.jpg';
// Rewrite
$url = "".$ligne["url_rewrite"]."/".$ligne["id_loisirs"];
// Suivant le type
if (!empty ($ligne['url_fnac'])) {
$type_photo = '<li>
<a href="'.$url.'"><img class="attachment-shop_thumbnail wp-post-image" src="'.$ligne['photo'].'" alt="'.$ligne['titre'].'" title="'.$aLoisirs[$ligne['id_type_loisirs']].' '.$ligne['titre'].'"></a>
<a href="annonce_zoom.php?id='.$ligne['id_loisirs'].'"><span class="product-title">'.cutTexte(ucfirst(strtolower($ligne['titre'])), 30, '...').'</span></a>
<span class="amount">'.strip_tags($ligne['city']).' ('.str_pad($ligne['id_departements'], 2, "0", STR_PAD_LEFT).')</span>
</li>';
}else{ echo'<li>
<a href="'.$url.'"><img class="attachment-shop_thumbnail wp-post-image" src="'.$image.'" alt="'.$ligne['titre'].'" title="'.$aLoisirs[$ligne['id_type_loisirs']].' '.$ligne['titre'].'"></a>
<a href="'.$url.'"><span class="product-title">'.cutTexte(ucfirst(strtolower($ligne['titre'])), 30, '...').'</span></a>
<span class="amount">'.strip_tags ($ligne['city']).' ('.str_pad($ligne['id_departements'], 2, "0", STR_PAD_LEFT).')</span>
</li>';
}
// fin
echo $type_photo ."\n";
}
} else {
echo 'Aucune annonce enregistrées ';
}
?>
Je ne vois pas le problème j'ai continuer a chercher, une fois dedirigé sur la bonne page grace à l'url rewrite
[b]127.0.0.1/lasortie/annonce_zoom.php?id=434502[/b] devient [b] http://127.0.0.1/lasortie/la-grande-sop ... mon/434502[/b]
Une fois dans la page redirigé mes liens déconne car il garde en parametre l'url
Si je clique sur une autre annonce il garde le parametre en compte pour l'exemple:
[b] http://127.0.0.1/lasortie/la-grande-sop ... mon/434502[/b]
si je clique sur une autre annonce :
Je me trouve sur la page http://127.0.0.1/lasortie/bourse-vetements/424157
je clique sur une autre annonce le lien devrait juste changer de titre et de id, la nan il le rajotue après et l'url devient
[b]http://127.0.0.1/lasortie/bourse-vetements/bourse-aux-jouets-matinee-boudin/424352[/b]
Le code qui m'affiche les annonces:
<?php
//Selection de l'annonce
$sql = ("SELECT * FROM loisirs WHERE id_loisirs = ".$_GET['id']." AND valide = 1");
$id = $_GET["id"];
$req = $bdd->query($sql);
$row = $req->fetch() ;
$req->closeCursor();
if($row["url_rewrite"]!=$row["url_rewrite"]) {
header("location:".$row["url_rewrite"]."/".$row["id_loisirs"]);
}
// Suite du code et plus loin on affiches les annonces
[php]<?php
$pub = "SELECT * FROM loisirs WHERE `id_type_loisirs` = $type AND `loisirs`.`date_fin_sortie` > NOW() and id_departements = $departement ";
$pub .= " ORDER BY id_loisirs DESC LIMIT 0, 5";
$req = $bdd->query($pub);
if($req->rowCount() > 0) {
while($ligne = $req->fetch(PDO::FETCH_ASSOC)){
$image = !empty($ligne['photo']) && file_exists($path.'img/annonce/600/'.$ligne['photo']) ? 'img/annonce/600/'.$ligne['photo'] : 'img/remplacement/'.simplification($aLoisirs[$ligne['id_type_loisirs']]).'.jpg';
// Rewrite
$url = "".$ligne["url_rewrite"]."/".$ligne["id_loisirs"];
// Suivant le type
if (!empty ($ligne['url_fnac'])) {
$type_photo = '<li>
<a href="'.$url.'"><img class="attachment-shop_thumbnail wp-post-image" src="'.$ligne['photo'].'" alt="'.$ligne['titre'].'" title="'.$aLoisirs[$ligne['id_type_loisirs']].' '.$ligne['titre'].'"></a>
<a href="annonce_zoom.php?id='.$ligne['id_loisirs'].'"><span class="product-title">'.cutTexte(ucfirst(strtolower($ligne['titre'])), 30, '...').'</span></a>
<span class="amount">'.strip_tags($ligne['city']).' ('.str_pad($ligne['id_departements'], 2, "0", STR_PAD_LEFT).')</span>
</li>';
}else{ echo'<li>
<a href="'.$url.'"><img class="attachment-shop_thumbnail wp-post-image" src="'.$image.'" alt="'.$ligne['titre'].'" title="'.$aLoisirs[$ligne['id_type_loisirs']].' '.$ligne['titre'].'"></a>
<a href="'.$url.'"><span class="product-title">'.cutTexte(ucfirst(strtolower($ligne['titre'])), 30, '...').'</span></a>
<span class="amount">'.strip_tags ($ligne['city']).' ('.str_pad($ligne['id_departements'], 2, "0", STR_PAD_LEFT).')</span>
</li>';
}
// fin
echo $type_photo ."\n";
}
} else {
echo 'Aucune annonce enregistrées ';
}
?>[/php]