+th/td cosmetic padding in the articles
[www.energie.vellum.cz.git] / clanek.php
1 <?php $cvs_id='$Id$';
2
3         include("common.php");
4
5         $head_css="
6 th,td { padding: 3px }
7 ";
8
9         prepvar("year" ,"[0-9]+");
10         prepvar("month","[0-9]+");
11         prepvar("id"   ,"[0-9]+",false/*required*/);
12
13         $title_tail=title_name($year,$month);
14         $result=db_query("select name,contents from $tb_clanek where year=$year and month=$month"
15                         .(isset($id) ? " and id=$id" : "")." order by id");
16         if (isset($id) && 1==mysql_num_rows($result)) {
17                 $row=mysql_fetch_array($result);
18                 $title_tail.=" - ".$row["name"];
19                 }
20
21         heading();
22         print("<h1>".title_name($year,$month)."</h1>\n");
23
24         if (isset($id) && 1!=mysql_num_rows($result))
25                 fatal("Zadaný èlánek nebyl nalezen");
26
27 function print_article($row)
28 {
29         print("<h2>".htmlspecialchars($row["name"])."</h2>\n".$row["contents"]);
30 }
31
32         if (isset($id))
33                 print_article($row);
34         else
35                 while (($row=mysql_fetch_array($result)))
36                         print_article($row);
37         mysql_free_result($result);
38
39         footer();
40 ?>