Bonsoir,
Je me suis mis récemment à l'URLRewriting.
J'ai besoin de checker tout mon contenu pour y trouver les url INTERNES et les ré-écrire.
Pour cela, j'ai voulu passer par preg_match_all pour les capturer... Sauf qu'il semblerait que je me sois planté à quelque part.
Mes urls internes sont de la forme : index.php?id=un-entier
J'ai donc fait la chose suivante :
Code php : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 private function ReecrireLiensContenu($A_Contenu) { if($this->page->ModRewrite) { preg_match_all('#index.php?id=([0-9]+)#isU', $A_Contenu, $L_Matches); print_r($L_Matches); } return $A_Contenu; }
Sauf que Matches reste complètement vite.
Voilà un exemple de contenu :
Code html : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 <p style="text-align: center;"><a href="index.php?id=78" target="_self"><span style="font-size: medium;"><span style="font-family: Comic Sans MS;">Eric Hossan</span></span></a></p> <p style="text-align: center;"><a target="_self" href="index.php?id=73"><span style="font-size: medium;"><span style="font-family: Comic Sans MS;">Denis Blémont-Cerli</span></span></a></p> <p style="text-align: center;"><a href="index.php?id=64" target="_self"><span style="font-family: Comic Sans MS;"><span style="font-size: medium;">Michel Sanz & Nico</span></span></a></p> <p style="text-align: center;"><a href="index.php?id=63" target="_self"><span style="font-size: medium;"><span style="font-family: Comic Sans MS;">Luc Antonini</span></span></a></p> <p style="text-align: center;"><a href="index.php?id=62" target="_self"><span style="font-family: Comic Sans MS;"><span style="font-size: medium;">Jean Paul Ceccaldi</span></span></a></p> <p style="text-align: center;"><a href="index.php?id=61" target="_self"><span style="font-family: Comic Sans MS;"><span style="font-size: medium;">Matthieu croizet</span></span></a></p>
Je veux capturer l'ID pour ensuite ré-écrire ^^
A votre avis, où j'ai pêché ?
Partager