h3/h4 is now cyan, cosmetic
[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 h3,h4 { color: cyan; background-color: transparent; }
8 ";
9
10         prepvar("year" ,"[0-9]+");
11         prepvar("month","[0-9]+");
12         prepvar("id"   ,"[0-9]+",false/*required*/);
13
14         $title_tail=title_name($year,$month);
15         $result=db_query("select name,contents from $tb_clanek where year=$year and month=$month"
16                         .(isset($id) ? " and id=$id" : "")." order by id");
17         if (isset($id) && 1==mysql_num_rows($result)) {
18                 $row=mysql_fetch_array($result);
19                 $title_tail.=" - ".$row["name"];
20                 }
21
22         heading();
23         print("<h1>".title_name($year,$month)."</h1>\n");
24
25         if (isset($id) && 1!=mysql_num_rows($result))
26                 fatal("Zadaný èlánek nebyl nalezen");
27
28 function print_article($row)
29 {
30         print("<h2>".htmlspecialchars($row["name"])."</h2>\n".$row["contents"]);
31 }
32
33         if (isset($id))
34                 print_article($row);
35         else
36                 while (($row=mysql_fetch_array($result)))
37                         print_article($row);
38         mysql_free_result($result);
39
40         footer();
41 ?>