<?php
/*******************************************************************************
** File : alllnews.php **
** Author : G.Ramkumar **
** Description : Dispalying all news section Query usedd in XML services **
** Date : 14/09/2005 **
** Last Modified : 14/09/2005 **
** PHP Version : 5.0.3 **
** **
*******************************************************************************/
$Totalnews_item="select * from rssurl_newsitem where frontend_export='Y' and language='$lang' order by url_newsitem_id desc";
$Totalnews_res=$pg_sql->query_pass($Totalnews_item,"4");
$Totalcnt=count($Totalnews_res);
$total_num = $Totalcnt;
//$limit = 25; // Set limit display news item per page
$limit = 15; // Set limit display news item per page
$offset = 0;
if($_REQUEST['offset']>0)
{
$offset = $_REQUEST['offset'];
}
$news_item="select * from rssurl_newsitem where frontend_export='Y' and language='$lang' order by url_newsitem_id desc limit $limit offset $offset";
$news_res=$pg_sql->query_pass($news_item,"4");
$cnt=count($news_res);
for($x=0;$x<$cnt;$x++)
{
$all_xml_id .=$news_res[$x]['url_newsitem_id'].",";
}
?>
<table width="95%" border="0" cellspacing="0" cellpadding="0" align="center">
<?if($cnt>0){?>
<tr>
<td bgcolor="D0D0D0" valign ="top" height="20">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="heading5" height="25"><?=$allnews_?></td>
<td align="right" valign="middle" class="heading5" height="25"><a target="_new" href="xml.php?id=<?=base64_encode(trim($all_xml_id,","))?>"><img border="0" src="images/rss-2.0.jpg" width="80" height="15" alt="Link to RSS Feed"></a> </td>
</tr>
</table>
</td>
</tr>
<?
for($i=0;$i<$cnt;$i++)
{
$id=$news_res[$i]['url_newsitem_id'];
$hour=str_replace(":","h",$news_res[$i]['hour']);
$desc=html_entity_decode($news_res[$i]['description']);
$desc=str_replace("||","'",$desc);
$date=$news_res[$i]['pubdate'];
$yesterday = strftime ("%e/%m/%Y", strtotime("-1 day"));
$yday=explode("/",$yesterday);
if(substr($yday[1],0,1)==0)
$ymon=str_replace("0","",$yday[1]);
else
$ymon=$yday[1];
$yesterday=trim($yday[0])."/".$ymon."/".$yday[2];
$today=date('j/n/Y');
if($date==$today)
$pubdate="Today";
elseif($date == $yesterday)
$pubdate="Yesterday";
else
$pubdate=$date;
if(strlen($desc)>200)
$desc=substr($desc,0,200)."....";
else
$desc=$desc;
$title=str_replace("||","'",$news_res[$i]['news_title']);
$rep_title=$title;
$rep_title=str_replace("é","é",$rep_title);
$rep_title=str_replace("â","",$rep_title);
$rep_title=str_replace("è","è",$rep_title);
$rep_title=str_replace("Ã","à",$rep_title);
$rep_title=str_replace("àª","ê",$rep_title);
$rep_title=str_replace("â","",$rep_title);
$rep_title=str_replace("à»",û,$rep_title);
$title=$rep_title;
?>
<tr>
<td><a href="<?=$news_res[$i]['url']?>" target="_new" class="contblue"><?=$title?></a>
<font class="contgrey"><?=$pubdate." ".$hour?></font>
</td>
</tr>
<?
}
?>
<tr><td> </td></tr>
<tr><td align="center" colspan="3">
<?php
$prev = $offset - $limit;
if($_REQUEST['cat_id']!="")
{
$catid="cat_id=".$_REQUEST['cat_id']."&";
if($_REQUEST['subcat_id']!="")
$subid="subcat_id=".$_REQUEST['subcat_id']."&";
}
if($prev>=0)
{
$off = $offset-$limit;
echo "<a href='index.php?".$catid.$subid."offset=".$off."&lang=".$lang."'><img src='images/previous.jpg' border='0' alt='Prev'></a> ";
}
$next = $offset + $limit;
if($next<$total_num)
{
$offset = $offset + $limit;
echo "<a href='index.php?".$catid.$subid."offset=".$offset."&lang=".$lang."'><img src='images/next.jpg' border='0' alt='Next'></a>";
}
?>
</td></tr>
<?}else{?>
<tr><td align="center" class="msg" valign="top" colspan="3">No News Available</td></tr>
<?}?>
<tr><td> </td></tr>
</table>
<br>