<% ' Substitution caracteres accentues par caracteres non accentues MotCle = Request.QueryString("Cle") MotCle = SubstMot(MotCle, "é","e") MotCle = SubstMot(MotCle, "è","e") MotCle = SubstMot(MotCle, "ê","e") MotCle = SubstMot(MotCle, "ç","c") MotCle = SubstMot(MotCle, "à","a") MotCle = SubstMot(MotCle, "ô","o") MotCle = SubstMot(MotCle, "î","i") MotCle = SubstMot(MotCle, "â","a") MotCle = UCase(MotCle)&" " %> Liste des collectivités répondant à la requête ----------
TITCOM.JPG (9129 octets) Retour page d'accueil Cdg82 plansite.gif (2751 octets)


Revenir à la recherche

D'un "clic", visitez virtuellement une commune.

 

<% dim objConnect dim fp_rs dim Let1Prec, Compteur fp_sNoRecords = "Aucune collectivité ne correspond au mot clé saisie" Let1Prec = "" Compteur = 0 set objConnect = Server.CreateObject("ADODB.Connection") objConnect.Open "DSN=cdg82" ' REQUETE ---------------------------------------------- fp_sQry = "SELECT NomHtml,Commentaire,LienHt1,LienHtCarte,SiteWeb,LienMotCle FROM collectivites ORDER BY NomHtml" set fp_rs = CreateObject("ADODB.Recordset") 'If fp_iMaxRecords <> 0 Then fp_rs.MaxRecords = fp_iMaxRecords fp_rs.Open fp_sQry, objConnect ' Vérifie les cas sans enregistrement If fp_rs.EOF And fp_rs.BOF Then Response.Write fp_sNoRecords NoRetour = "Aucune collectivité ne correspond au mot clé saisie" Else Set FileObject = Server.CreateObject("Scripting.FileSystemObject") NoRetour = "" ' Démarre une boucle While pour inclure chaque enregistrement dans l'ensemble de résultat Do Until fp_rs.EOF If Not IsEmpty(fp_rs) And Not (fp_rs Is Nothing) Then 'Init Chemin + Nom fichier des mots clé If fp_rs("LienMotCle") <> "" Then LienMotCle = Server.MapPath(Cstr(fp_rs("LienMotCle"))) Else LienMotCle = "" End If Trouve = False If LienMotCle <> "" And FileObject.FileExists(LienMotCle) Then Set InStream= FileObject.OpenTextFile (LienMotCle, 1, False, False) 'If Not IsEmpty(InStream) Then 'Boucle de lecture du fichier des mots clé Do Until InStream.AtEndOfStream LineLu = UCase(InStream.Readline) Pos = InStr(MotCle, LineLu) If Pos <> 0 and LineLu <> "" Then Trouve = True Compteur = Compteur + 1 Exit Do End If Pos = InStr(LineLu, MotCle) If Pos <> 0 and MotCle <> "" Then Trouve = True Compteur = Compteur + 1 Exit Do End If Loop InStream.Close If Trouve Then NomCommune = CStr(fp_rs("NomHtml")) Let1Cour = Left(NomCommune,1) LienSite = CStr(fp_rs("LienHt1")) LienCarte = CStr(fp_rs("LienHtCarte")) Comment = CStr(fp_rs("Commentaire")) SiteW = CStr(fp_rs("SiteWeb")) %> <% Else %> <%=NomCommune%> <% End If 'SiteW End If 'Trouve End If 'FileExists End If ' Ferme la boucle de recherche d'enregistrements fp_rs.MoveNext Loop End If fp_rs.Close set fp_rs = nothing set objConnect = nothing %>
Collectivité
Description
Situation
<% If Let1Cour <> Let1Prec Then Let1Prec = Let1Cour %>

<% End If If SiteW Then %> <%=NomCommune%>

<%=Comment%>
   
<% If Compteur > 1 Then Retour = " communes trouvées" Else Retour = " commune trouvée" End If %> <% =Compteur %> <% =Retour %> avec le mot-clé <%=MotCle%>