Introduction

Rewriting

Begain

Setup YOUR GuppY

Tests


Connect again
---

Your name (or pseudo) :

Your secret code (associated with your pseudo)


 Count of members 19 members


Connected :

(nobody)
Visits

   visitors

   visitors online

Search




Coming from ?
forum.gifForum - Rewriting - Topic #21

Forum charter - Forum charter

Forum - Forum
Rewriting - Rewriting
- Topic # 21


active Topic # 21  Categorie dans url rewriting

21/03/2008 @ 09:45
by patrick29

Anonymous

visitor

Bonjour

J'ai installe les modifications pour avoir l'url rewriting, ca fonctionne tres bien et j'ai des pages sous ce format:

/article-133-Titre_de_l_article-fr.html

mais je voudrais avoir la categorie donc ce format:

/Catégorie-Titre_de_l_article-133-fr.html

Comment puis je modifier les fichiers et lesquels?

Merci

Patrick
  Post an answer  Top

[]   

StartPrevious one [ 1 2 ] Next oneEnd
Answer n° 1
--------
21/03/2008 @ 13:21
by URLrewriting

URLrewriting

Administrator
37 messages
Bonjour,

pour ce faire, il va te falloir modifier les fichiers inc/boxartg.inc et inc/boxartd.inc aux lignes 81 à 86 ,

remplacer :
Code : php
        if($­site[32] == "on" ){######           
if ($­curr_art == $­arttbl[$­i][2]) {
echo '<li class="curr_item">'.$­curr_marq.'<a href="'.$­url.$­arttbl[$­i][2].'-'.KeepGoodChars(strip_tags($­arttbl[$­i][1])).'-'.$­lng.'.html ">'.$­arttbl[$­i][1].'</a>'."n";
} else {
echo '<li class="item">'.$­marqueur.'<a href="'.$­url.$­arttbl[$­i][2].'-'.KeepGoodChars(strip_tags($­arttbl[$­i][1])).'-'.$­lng.'.html ">'.$­arttbl[$­i][1].'</a>'."n";
}
 
par :
Code : php
        if($­site[32] == "on" ){######           
if ($­curr_art == $­arttbl[$­i][2]) {
echo '<li class="curr_item">'.$­curr_marq.'<a href="'.$­url.'-'.KeepGoodChars(strip_tags($­arttbl[$­i][1])).'-'.$­arttbl[$­i][2].'-'.$­lng.'. html">'.$­arttbl[$­i][1].'</a>'."n";
} else {
echo '<li class="item">'.$­marqueur.'<a href="'.$­url.'-'.KeepGoodChars(strip_tags($­arttbl[$­i][1])).'-'.$­arttbl[$­i][2].'-'.$­lng.'. html">'.$­arttbl[$­i][1].'</a>'."n";
}
 


ligne 110
,

remplacer :
Code : php
                echo '<option value="'.$­url.$­arttbl[$­i][2].'-'.KeepGoodChars(strip_tags($­arttbl[$­i][1])).'-'.$­lng.'.htm l">&nbsp;&nbsp;'.$­marqueur.'&nbsp;'.substr(strip_tags($­arttbl[$­i][1]), 0, $­maxlen).'</option>'."n";
 
par :
Code : php
                echo '<option value="'.$­url.'-'.KeepGoodChars(strip_tags($­arttbl[$­i][1])).'-'.$­arttbl[$­i][2].'-'.$­lng.' .html">&nbsp;&nbsp;'.$­marqueur.'&nbsp;'.substr(strip_tags($­arttbl[$­i][1]), 0, $­maxlen).'</option>'."n";
 

la suite plus bas .....
Write to URLrewriting   Web site URLrewriting Post an answer  Top
Answer n° 2
--------
21/03/2008 @ 13:24
by URLrewriting

URLrewriting

Administrator
38 messages
suite ....

lignes 143 à 148 ,

remplacer :
 
Code : php
       if($site[32] == "on" ) {######
if ($curr_art == $arttbl[$i][2]) {
echo '<li class="curr_item">'.$curr_marq.'<a href="'.$url.$arttbl[$i][2].'-'.KeepGoodChars(strip_tags($arttbl[$i][1])).'-'.$lng.'.html "> '.$arttbl[$i][1].'</a></li>'."\n";
} else {
echo '<li class="item">'.$marqueur.'<a href="'.$url.$arttbl[$i][2].'-'.KeepGoodChars(strip_tags($arttbl[$i][1])).'-'.$lng.'.html "> '.$arttbl[$i][1].'</a></li>'."\n";
}
 
par :
Code : php
        if($site[32] == "on" ) {######
if ($curr_art == $arttbl[$i][2]) {
echo '<li class="curr_item">'.$curr_marq.'<a href="'.$url.'-'.KeepGoodChars(strip_tags($arttbl[$i][1])).'-'.$arttbl[$i][2].'-'.$lng.'. html"> '.$arttbl[$i][1].'</a></li>'."\n";
} else {
echo '<li class="item">'.$marqueur.'<a href="'.$url.'-'.KeepGoodChars(strip_tags($arttbl[$i][1])).'-'.$arttbl[$i][2].'-'.$lng.'. html"> '.$arttbl[$i][1].'</a></li>'."\n";
}
 
ceci dans les 2 fichiers précédemment cités


enfin il te faudra redéfinir dans ton htaccess, la façon dont les urls seront interprétées.
de cette manière :

remplacer :
Code :
RewriteRule ^article-([0-9]*)-([a-zA-Z0-9|_-]+)-([a-z]*).html$ articles.php?lng=$3&pg=$1  [L]
 
par
Code :
RewriteRule ^article-([a-zA-Z0-9|_-]+)-([0-9]*)-([a-z]*).html$ articles.php?lng=$3&pg=$2  [L]
 

voilà, ça devrait le faire e
Write to URLrewriting   Web site URLrewriting Post an answer  Top
Answer n° 3
--------
21/03/2008 @ 14:06
by patrick29

Anonymous

2 messages
Merci pour ta reponse et ton aide, je vais essayer tes modifs et je  reviendrais donner le resultat.

Patrick
Write to patrick29   Post an answer  Top
Answer n° 4
--------
21/03/2008 @ 14:25
by URLrewriting

URLrewriting

Administrator
39 messages
ok Patrick,
pense à nous laisser ton URL
merci.
Write to URLrewriting   Web site URLrewriting Post an answer  Top
Answer n° 5
--------
21/03/2008 @ 18:09
by patrick29

Anonymous

3 messages
Bon, j'ai fais toutes les modifs et ca ne fonctionne pas, lorsque je clique sur un lien ca reste bloque sur la page index...

Patricka
Write to patrick29   Post an answer  Top
Answer n° 6
--------
23/03/2008 @ 21:56
by URLrewriting

URLrewriting

Administrator
40 messages
vérifie ton htaccess ...

je viens seulement de réaliser que tu souhaitais inclure la catégorie k, il faut que je me penche dessus, actuellement les modifs proposées te permettent d'avoir des urls du style :
/Titre_de_l_article-133-fr.html

merci de laisser l'URL de ton site
Write to URLrewriting   Web site URLrewriting Post an answer  Top
Answer n° 7
--------
24/03/2008 @ 00:28
by patrick29

Anonymous

visitor
Actuellement les modifs ne me permettent pas d'avoir de rewritting du tout puisque avec les modifs les liens ne fonctionnent pas, ca reste bloque sur la page index.

Mon htaccess est correcte.

l'url du site est:

http://www.***.com

Attention c'est un site pour ADULTES+18 ans

Patrick
Rectifié par URLrewriting le 24/03/2008 @ 00:53
  Post an answer  Top
Answer n° 8
--------
24/03/2008 @ 00:38
by URLrewriting

URLrewriting

Administrator
41 messages
Citation :

ca reste bloque sur la page index.

 
pour ma part, j'arrive bien à l'article :
http://www.***.com/article-79-Films_Mangas-fr.html
par exemple.

as-tu essayé de vider le cache de ton navigateur ? ( je suis sous firefox )
Rectifié par URLrewriting le 24/03/2008 @ 00:53
Write to URLrewriting   Web site URLrewriting Post an answer  Top
Answer n° 9
--------
24/03/2008 @ 01:20
by patrick29

Anonymous

5 messages
Non mais la ca marche. C'est la modif fournie sur ce site qui fournit des url du style

/article-133-Titre_de_l_article-fr.html
 avec laquelle je n'ai pas de probleme,

ce qui ne marche pas c'est les modifs que tu m'as fournie pour faire apparaitre la categorie style:

/Catégorie-Titre_de_l_article-133-fr.html

qui, une fois les modifs appliquees fait que les liens ne fonctionnent plus et que ca reste bloque sur la page index. J'ai donc enleve les modifs "Categories" et remis celles d'avant, 

Patrick
Write to patrick29   Post an answer  Top
Answer n° 10
--------
24/03/2008 @ 01:47
by URLrewriting

URLrewriting

Administrator
42 messages
Je viens de rajouter les catégories ici sur ce site e
du style :

/article-133-Catégorie-Titre_de_l_article-fr.html

simplement en insérant dans les lignes précitées :

Code : php
'-'.KeepGoodChars(strip_tags($arttbl[$i][0])).'-'
 ( avant chaque :
Code : php
'-'.KeepGoodChars(strip_tags($arttbl[$i][1])).'-'
 )

au final donc :
Code : php
...'-'.KeepGoodChars(strip_tags($arttbl[$i][0])).'-'.KeepGoodChars(strip_tags($arttbl[$i] [1])).'-' etc..
 
k
Write to URLrewriting   Web site URLrewriting Post an answer  Top
StartPrevious one [ 1 2 ] Next oneEnd
active topic active   closed topic closed   Sticky Sticky   New New message   -   Correct Correct message   Close Close topic   Make sticky Make sticky
[]
Forum Topic  Forum 


^ Top ^