Viewing file: block_news.php (5.72 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
/********************************************************************************
- MemHT Portal -
Copyright (C) 2007-2008 by Miltenovik Manojlo
http://www.memht.com
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your opinion) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, see <http://www.gnu.org/licenses/> (GPLv2)
or write to the Free Software Foundation, Inc., 51 Franklin Street,
Fifth Floor, Boston, MA02110-1301, USA.
********************************************************************************/
if (stristr(htmlentities($_SERVER['PHP_SELF']), "block_news.php")) {
die("<table style='padding: 2px; border: 1px solid #999; background-color: #EEE; font-family: Verdana; font-size: 10px;' align='center'><tr><td><b>Error:</b> This file cannot be opened directly!</td></tr></table>");
}
global $dblink;
/*
$news_result = $dblink->get_list("SELECT id,nome FROM memht_news WHERE enabled=1 ORDER BY id DESC LIMIT 20");
foreach ($news_result as $row_news) {
$nid = intval($row_news['id']);
$nnome = outCode($row_news['nome']);
echo "<div class='block_linkstyle'><a href='index.php?page=news&op=readNews&id=$nid&title=".mem_urlencode($nnome)."' title='$nnome'>$nnome</a></div>\n";
}
*/
echo "<br><br>";
echo "<table border='0' width='90%' align='center' cellpadding='0'>";
// $news_result = $dblink->get_list("SELECT id,nome,imgfile,testo_home FROM memht_news WHERE enabled=1 ORDER BY id DESC LIMIT 5");
$news_result = $dblink->get_list("SELECT id,nome,imgfile,testo_home FROM memht_news WHERE enabled=1 ORDER BY id DESC LIMIT 6");// à»ÅÕè¹ LIMIT 5 à»ç¹ LIMIT 6
$num=0; // ¡Ó˹´¤èÒµÑÇá»Ã $num =0
foreach ($news_result as $row_news) {
$nid = intval($row_news['id']);
$nnome = outCode($row_news['nome']);
$imgfile = outCode($row_news['imgfile']);
$testo_home = outCode($row_news['testo_home']);
//echo "<div class='block_linkstyle'> <img src='images/news2.gif'> <img src='pages/news/news/$imgfile' width='30' height='30'><a href='index.php?page=news&op=readNews&id=$nid&title=".mem_urlencode($nnome)."' title='$nnome'>$nnome</a></div>\n";
//echo "<div class='block_linkstyle'> <img src='pages/news/news/$imgfile' width='30' height='30'> <a href='index.php?page=news&op=readNews&id=$nid&title=".mem_urlencode($nnome)."' title='$nnome'><b>$nnome</b></a><br>$testo_home</div>\n";
// echo "<tr>";
// echo "<td rowspan='2' valign='top' width='100'>";
$num++; // à¾ÔèÁµÑÇá»Ã $num
if($num==1){ // check µÑÇá»Ã $num
echo "<tr>"; // ¢Öé¹á¶ÇãËÁè
} // »Ô´ if
echo "<td valign='top' height='70' width='10%' align='center'>"; // ¢Ö鹤ÍÅÑÁãËÁè
if($imgfile !="" ){
echo "<img src='pages/news/news/$imgfile' width='50' height='50' border='1'>";
}
echo "</td>";
echo "<td> <a href='index.php?page=news&op=readNews&id=$nid&title=".mem_urlencode($nnome)."' title='$nnome'><b>$nnome</b></a></td>";
//echo "</tr>";
//echo "<tr>";
//echo "<td valign='top' height='45'>$testo_home</td>";
//echo "</tr>";
if($num==2){ // check µÑÇá»Ã $num ÇèÒà»ç¹¤ÍÅÑÁ·ÕèÊͧ ãËé»Ô´ á¶Ç
echo "</tr>"; // »Ô´ á¶Ç
$num=0; // ãËé $num à·èҡѺ 0 ¤×ÍàÃÔèÁ¹Ñº ¤ÍÅÑÁ à»ç¹ 0
}//»Ô´ if
}
echo "</table>";
///////////////////////////////////////////////////////////////////////////////////////////////////////////
echo '<br />';
echo "<div class='tpl_opentable_title'>ข่าวสาร</div>\n";
echo '<br />';
$result = $dblink->get_list("SELECT * FROM memht_argomenti ORDER BY nome");
foreach ($result as $row) {
$aid = intval($row['id']);
$nome = outCode($row['nome']);
echo " <img src='images/file.gif'>";
echo " <b>$nome</b> <a href='index.php?page=news&op=allNews&id=$aid&title=".mem_urlencode($nnome)."' title='$nnome'>[อ่านข่าวทั้งหมด]</a>\n";
// new
echo " <table border='0' width='90%' align='center'>";
$news_result = $dblink->get_list("SELECT id,nome,imgfile,testo_home,data FROM memht_news WHERE enabled=1 and argomento='$aid' ORDER BY id DESC LIMIT 6");
foreach ($news_result as $row_news) {
$nid = intval($row_news['id']);
$nnome = outCode($row_news['nome']);
$imgfile = outCode($row_news['imgfile']);
$testo_home = outCode($row_news['testo_home']);
$data = outCode($row_news['data']);
//echo "<div class='block_linkstyle'> <img src='images/news2.gif'> <img src='pages/news/news/$imgfile' width='30' height='30'><a href='index.php?page=news&op=readNews&id=$nid&title=".mem_urlencode($nnome)."' title='$nnome'>$nnome</a></div>\n";
//echo "<div class='block_linkstyle'> <img src='pages/news/news/$imgfile' width='30' height='30'> <a href='index.php?page=news&op=readNews&id=$nid&title=".mem_urlencode($nnome)."' title='$nnome'><b>$nnome</b></a><br>$testo_home</div>\n";
echo "<tr>";
echo "<td> <img src='images/bullet.gif'> ";
echo "<a href='index.php?page=news&op=readNews&id=$nid&title=".mem_urlencode($nnome)."' title='$nnome'>$nnome</a> [".printdate($data)."]</td>";
echo "</tr>";
}
echo "</table>";
echo "<br>\n";
}
echo "<br><hr>\n";
?>
|