Created the object oriented experimental branch
[simplecm.git] / modules / news / module.php
blob696a947f04db1d53c87068109f34c61a9ac2ea87
1 <?php
3 $intblock = 0;
4 $BlockContent = null;
5 $BlockAuthor = null;
6 $BlockTitle = null;
7 $BlockDate = null;
8 if($_GET["id"]){
9 $news_id = $_GET["id"];
10 $sql = "SELECT * FROM `news` WHERE news_id='".$news_id."' AND active='yes'";
11 $res = mysql_query($sql, $db_cnct);
12 while ($block = mysql_fetch_assoc($res)) {
13 echo ("<div id='mod'>");
14 echo $block["Title"];
15 echo "</div><br><div id='mod'>";
16 echo $block["Content"];
17 echo "<br><br>";
18 if($block["comment"] == "yes"){
19 $who = "Commented on By: ";
20 }else{$who = "Posted By: ";}
21 echo $who . $block['Author'] . " on " . $block['DateAdded'] . "</div><br><br>";
23 echo "<div id='mod'>Comment on this Post:";
24 echo ("<form action='content/newscomment.php' method='post' >
25 <br>Email:<br><input type='text' name='email' >
26 <br>Subject:<br><input type='text' name='subject' >
27 <br>Comment:<br><textarea name='content' ></textarea>
28 <input type='hidden' name='news_id' value='$news_id' />
29 <br><input type='Submit' value='Comment!'>
30 </form></div>");
33 }else{
34 $sql = "SELECT * FROM news WHERE comment='no' and active='yes' ORDER BY news_id DESC";
35 $res = mysql_query($sql, $db_cnct);
37 while ($block = mysql_fetch_array($res)) {
38 $BlockTitle[$intblock] = $block["Title"];
39 $BlockAuthor[$intblock] = $block["Author"];
40 $BlockContent[$intblock] = $block["Content"];
41 $BlockDate[$intblock] = $block["DateAdded"];
42 $BlockNum[$intblock] = $block["news_id"];
43 $intblock++; }
45 for ($Cycle = 0; $Cycle <= $intblock; $Cycle++)
47 if (isset($BlockContent[$Cycle]))
49 echo ("<div id='mod'><a href='?section=news&id=$BlockNum[$Cycle]'>$BlockTitle[$Cycle]</a></div><br><div id='mod'>$BlockContent[$Cycle]<br><br>Posted by $BlockAuthor[$Cycle] on $BlockDate[$Cycle]</div><br><br>");