Commit | Line | Data |
---|---|---|
c495c100 P |
1 | #CACHE{0} |
2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
3 | <html dir="#LANG_DIR" lang="#LANG"> | |
4 | <!-- Inclure header.php3 --> | |
5 | <head> | |
6 | <INCLURE{fond=header_espace_enseig}{id_article}{id_rubrique}> | |
7 | </head> | |
8 | <body> | |
9 | <div id="frame"> | |
10 | <!-- Fin contener top --> | |
11 | <INCLURE{fond=contener_top_espace_enseig}> | |
12 | <!-- Fin contener top --> | |
13 | <div id="contener"> | |
14 | <!-- Menu --> | |
15 | <INCLURE{fond=menu_espace_enseig}{id_rubrique=266}> | |
16 | <!-- Fin Menu --> | |
17 | <!-- CONTENU --> | |
18 | <div id="colonne_center"> | |
19 | <div id="haut_ligne_contener_center"></div> | |
20 | <div id="colonne_center_contenu"> | |
21 | <div id="contenu_top"> | |
22 | <p><span class="img_titre"><img src="[(#URL_SITE_SPIP)/]IMG/arton2.gif" alt="" width="27" height="26" class="spip_logos" /></span>Résultats de votre recherche</p> | |
23 | </div> | |
24 | <div id="contenu"> | |
25 | <!-- TEXTE --> | |
26 | <?php | |
27 | function google_like($string){ | |
28 | $query = rtrim(str_replace("+", " ", $_GET['recherche'])); | |
29 | $qt = explode(" ", $query); | |
30 | $num = count ($qt); | |
31 | $cc = ceil(200 / $num); | |
32 | for ($i = 0; $i < $num; $i++) { | |
33 | $tab[$i] = preg_split("/($qt[$i])/i",$string,2, PREG_SPLIT_DELIM_CAPTURE); | |
34 | if(count($tab[$i])>1){ | |
35 | $avant[$i] = substr($tab[$i][0],-$cc,$cc); | |
36 | $apres[$i] = substr($tab[$i][2],0,$cc); | |
37 | $string_re .= "<i>[...]</i> $avant[$i]<b>".$tab[$i][1]."</b>$apres[$i] <i>[...]</i> "; | |
38 | } | |
39 | } | |
40 | return $string_re; | |
41 | } | |
42 | $NbResults = 0; // initialisation du comptage | |
43 | $MaxPts = 0;?> | |
44 | ||
45 | <BOUCLE_CountArticles(ARTICLES){recherche}{id_secteur IN 195}{par points}{inverse}> | |
46 | ||
47 | <? | |
48 | $NbResults++; // bête incrémentation (basique mais efficace) | |
49 | if ($MaxPts==0) $MaxPts = #POINTS; // ?> | |
50 | </BOUCLE_CountArticles> | |
51 | ||
52 | <? | |
53 | if (!isset($HTTP_GET_VARS["debut_lb"])) $debut_lb = 0; // ça, c'est mon paramètre à passer en GET dans l'URL | |
54 | ||
55 | $Page = floor($debut_lb/10) + 1; // numéro de page dans laquelle on est | |
56 | $MaxPage = floor($NbResults/10) + 1; // dernière page | |
57 | $Last = ($debut_lb+11<$NbResults) ? $debut_lb+10 : $NbResults; // dernier résultat affiché (permet d'écrire:"résultats X à Y affichés sur un total de Z" -> voir plus bas) | |
58 | ||
59 | ?> | |
60 | ||
61 | <form action="#URL_SITE_SPIP/spip.php?page=recherche_espace_enseig" method='get'> | |
62 | <input name='page' value='recherche' type='hidden' /> | |
63 | <input type="text" name="recherche" size="24" value="<? echo $recherche; ?>" class="form_lettre"> | |
64 | <input type="submit" name="envoyer" value="Recherche" /> | |
65 | </form> | |
66 | <? | |
67 | if ($NbResults > 0) { | |
68 | // | |
69 | ?> | |
70 | <p><b><?echo $NbResults; ?> document(s) trouvé(s)</b></p> | |
71 | <? | |
72 | } | |
73 | else { ?> | |
74 | <p>Aucun document n'a été trouvé dans articles pour le(s) mot(s) « <?php echo $_GET['recherche']; ?> »</p> | |
75 | <? | |
76 | } ?> | |
77 | <p align="center"> | |
78 | <? | |
79 | ||
80 | if ($MaxPage>1) { | |
81 | for ($i=0;$i<$MaxPage;$i++) { | |
82 | if ($i+1==$Page) { ?> | |
83 | <b><font color='#999933'><? echo $i+1; ?></font></b> | |
84 | <? | |
85 | } | |
86 | else { | |
87 | if ($i+1<$Page) { ?> | |
88 | <a href='spip.php?page=recherche_espace_enseig&recherche=<? echo urlencode($recherche); ?><? if ($i) {echo "&debut_lb="; echo 10*$i;} ?>'>|<? echo $i+1; ?>|</a> | |
89 | <? | |
90 | } | |
91 | else { ?> | |
92 | <a href='spip.php?page=recherche_espace_enseig&recherche=<? echo urlencode($recherche); ?>&debut_lb=<? echo 10*$i; ?>'>|<? echo $i+1; ?>|</a> | |
93 | <? | |
94 | } | |
95 | } | |
96 | } | |
97 | } ?> | |
98 | </p> | |
99 | <B_recherche_site_articles> | |
100 | <BOUCLE_recherche_site_articles(ARTICLES){recherche}{id_secteur IN 195}{par points}{inverse}{debut_lb,10}> | |
101 | <? // calcul du pourcentage (option amusante mais pas performante) | |
102 | $PerCent = 100 * #POINTS / $MaxPts; ?> | |
103 | <p><font color=#666600>[<? echo number_format($PerCent, 0); ?> %] </font><span class="texte_E76600"><a href="#URL_ARTICLE" [title="(#INTRODUCTION|textebrut|entites_html)"]>[(#TITRE|supprimer_numero) ]</a></span><br> | |
104 | <?php | |
105 | $string = '[(#TEXTE|textebrut|texte_script)]'; | |
106 | echo google_like($string); | |
107 | ?> | |
108 | <span class="texte_E76600"><a href="#URL_ARTICLE" [title="(#INTRODUCTION|textebrut|entites_html)"]> Lire</a></span> | |
109 | </p> | |
110 | </BOUCLE_recherche_site_articles> | |
111 | </B_recherche_site_articles> | |
112 | ||
113 | <!-- fin du TEXTE --> | |
114 | <div id="contenu_notes_bas_page"></div> | |
115 | </div> | |
116 | <div id="contenu_bottom"> | |
117 | <!-- contenu _ bottom --> | |
118 | <!--<a href="javascript:OuvrirFenetre('[(#URL_SITE_SPIP)/]spip.php?page=imprimer&id_article=#ID_ARTICLE');"><img src="images/css/print.gif" alt="Imprimez cet article" title="Imprimez cet article" width="39" height="33" border="0"/></a>--> | |
119 | <!-- fin du contenu _ bottom --> | |
120 | </div> | |
121 | </div> | |
122 | <div id="bas_ligne_contener_center"></div> | |
123 | </div> | |
124 | <!-- FIN CONTENU --> | |
125 | <!-- DÉBUT BOTTOM --> | |
126 | <INCLURE{fond=bottom}> | |
127 | <!-- FIN BOTTOM --> | |
128 | </div> | |
129 | ||
130 | </div> | |
131 | </body> | |
132 | </html> |