comparison tag.php @ 0:629389204276

Import initial
author Franck Deroche <webmaster@defr.org>
date Sat, 20 Oct 2007 14:15:10 +0200
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:629389204276
1 <?php
2 setlocale(LC_ALL, "fr_FR.utf8@euro", "fr_FR.utf8");
3 include("classes.php");
4 $tag = $_GET['tag'];
5 $Data = new DataAccess;
6 include("top.php");
7 $Data->Query("
8 SELECT *
9 FROM Mess M, Tags T, Lien_Tags_Posts L
10 WHERE M.num_version='Version 10' AND T.Tag='{$tag}' AND M.num_mess=L.idMess AND L.idTag=T.idTag
11 ORDER BY num_mess DESC");
12 $i=0;
13 while(($row=$Data->GetRow()) && $i++<10) {
14 $mood = '';
15 $Mess=$Data->utf8_ensure(str_replace("<P>","<p>",str_replace("</P>","</p>", $row['Message'])));
16 $dateFormatee = strftime("%A %d %B %Y, %Hh%M", strtotime($row['DatePost']));
17 $Titre = $Data->utf8_ensure($row['Titre']);
18 $Titre_url = str_replace(" ", "_", strip_tags($Titre));
19 $Titre_url = str_replace("-", "_", $Titre_url);
20 $Titre_url = str_replace(array("é", "è"), "e", $Titre_url);
21 $Titre_url = str_replace("à", "a", $Titre_url);
22 $Titre_url = str_replace("ù", "u", $Titre_url);
23 $Titre_url = str_replace(array("î", "ï"), "i", $Titre_url);
24 if(!empty($row['Emot'])) {
25 $mood = "<img src='/blog/mood/{$row['Emot']}.png' alt='Mood : {$row['Emot']}' class='mood' />";
26 $row['Emot'] = " " . $row['Emot'];
27 }
28 $nbTags = $Data->Query("
29 SELECT T.Tag
30 FROM Tags T, Lien_Tags_Posts L
31 WHERE L.idMess={$row['num_mess']} AND L.idTag = T.idTag
32 ORDER BY T.Tag
33 ", 2);
34 $tags = '';
35 if($nbTags > 0)
36 {
37 $tags = "<span class='Tags'><em>Tags</em> :";
38 while(0 !== ($tag = $Data->GetRow(2)))
39 $tags .= " <a href='/blog/tags/{$tag['Tag']}'>{$tag['Tag']}</a> |";
40 $tags = substr($tags, 0, -1) . ' ;</span><br />';
41 }
42
43 echo("
44 <div class='PostContent{$row['Emot']}'>
45 <h2>{$Titre} | <span class='Date'>{$dateFormatee}</span></h2>
46 {$mood}
47 {$Mess}
48 <p class='postInfos'>
49 {$tags}
50 <a href=\"/blog/posts/{$row['num_mess']}-{$Titre_url}\">#{$row['num_mess']}</a> -
51 <a href=\"/blog/posts/{$row['num_mess']}-{$Titre_url}\">
52 ");
53 if(!is_null($row['NbCommentaires']) && $row['NbCommentaires']!=0)
54 echo("Un 'tit commentaire ( {$row['NbCommentaires']} ) ?");
55 else
56 echo("Un 'tit commentaire ?");
57 echo("
58 </a>
59 </p>
60 </div>");
61 }
62 $Data->Close();
63 include("foot.php");
64 ?>