Location: PHPKode > projects > News Manager - RSS aggregator > newsmanager/readalso.php
<?php
	/*******************************************************************************
     **  File          :  readalso.php                                            **
     **  Author        :  G.Ramkumar                                              **
     **  Description   :  right navigation menus 								  **
  	 **  Date          :  14/07/2005                                              **
     **  Last Modified :  02/08/2005                                              **
     **  PHP Version   :  5.0.3                                                   **
     **                                                                           **
     *******************************************************************************/
 if($page_name_!="index.php")
   include('readalso_qry.php');

if($_REQUEST['offset']=="" || $_REQUEST['offset']==0)
{
	if(count($cnt_xml)>0 && $page_name_ == "index.php")
	{
?>
  <table width="110%" border="0" cellspacing="0" cellpadding="0">
       <tr>
          <td width="38%" nowrap valign="middle" class="heading5"><?=$readalso_?>&nbsp;&nbsp;
           </td>
          <td width="62%" class="heading5" align="center" height="25"><a href="xml.php?<?=$readrss_cat_name?>new_id=<?=base64_encode(trim($xml_id_new_r,","))?>&id=<?=base64_encode(trim($xml_id_r,","))?>" target="_new"><?if($display_style_==1){?><img src="images/rss-2.0.jpg" width="80" height="15" border="0" alt="Link to RSS Feed"><?}else{?> <img src="images/<?=$rss_style_?>" border="0" align="absmiddle" alt="Link to RSS Feed"><?}?></a>&nbsp;</td>
       </tr>
   </table>

<?
	}
	if($page_name_ == "index.php")
	{
		for($i=0;$i<$readalsocnt;$i++)
		{
			$newsid=$readalso_res[$i][newsitem_id];
			$readalso_news="select * from rssurl_newsitem where url_newsitem_id=$newsid and frontend_export='Y' and language='$lang'";
			$readalsonews_res=$pg_sql->query_pass($readalso_news,"4");

			$xml_readalso_new_news="select * from new_newsitem where newsitem_id=$newsid and frontend='Y' and language='$lang'";
			$xml_readalsonew_news_res=$pg_sql->query_pass($xml_readalso_new_news,"4");

			if(count($res_c)<5)
			{
				if($readalsonews_res[0]['url_newsitem_id']!="")
				{
					$exist=0;
					$id=$readalsonews_res[0]['url_newsitem_id'];
					$xml_id .=$id."_";
					//$hour=str_replace(":","h",$readalsonews_res[0]['hour']);
					$date=explode("-",$readalsonews_res[0]['pubdate']);
   	 				$date=$date[2]."/".$date[1]."/".$date[0];

					$yesterday = strftime ("%e/%m/%Y", strtotime("-1 day"));
					$yday=explode("/",$yesterday);
					/*	if(substr($yday[1],0,1)==0)
						  $yday[1]=str_replace("0","",$yday[1]);
						else*/
						  $yday[1]=$yday[1];

						if(strlen(trim($yday[0]))==1)
			   	   		  $yday[0] ="0".trim($yday[0]);

					$yesterday=trim($yday[0])."/".$yday[1]."/".$yday[2];
					$today=date('d/m/Y');

					   if($date==$today)
						  $pubdate=$today_;
						elseif($date == $yesterday)
						  $pubdate=$yesterday_;
						else
						  $pubdate=$date;


				$title=str_replace("||","'",$readalsonews_res[0]['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);
				$rep_title=str_replace("…","...",$rep_title);
				$title=$rep_title;

				$read_enclosure_=$readalsonews_res[0]['enclosure'];
				if($read_enclosure_!="")
				  //$read_en_play='<a href="'.$read_enclosure_.'" target="_new"><img alt="Play" src="images/Play1.jpg" border="0"></a>';
				  $read_en_play='<img src="images/Play1.jpg" border="0" alt="Play" onclick="Audio.URL=\''.$read_enclosure_.'\'; Audio.controls.play()"  align="absmiddle" style="cursor:hand;">';
				else
				  $read_en_play='';

	?>
		<tr><td align="left" height="25" valign="top"><a class="contblue1" href="<?=$readalsonews_res[0]['url']?>" target="_new"><?=$title?></a>&nbsp;<?=$read_en_play?>
			 <?if($pubdate!=""){?>
				&nbsp;<font class="grey"><?=$pubdate?></font>
			 <?}?>
	    </td></tr>
	<?
		 $res_c[]=$exist;
		}
		if($xml_readalsonew_news_res[0]['newsitem_id']!="")
		{
				$exist=0;
				$id=$xml_readalsonew_news_res[0]['newsitem_id'];
				$xml_id .=$id."_";
				$date=explode("-",$xml_readalsonew_news_res[0]['pubdate']);
				$date=$date[2]."/".$date[1]."/".$date[0];

				$yesterday = strftime ("%e/%m/%Y", strtotime("-1 day"));
				$yday=explode("/",$yesterday);
				/*	if(substr($yday[1],0,1)==0)
					  $yday[1]=str_replace("0","",$yday[1]);
					else
				*/
					  $yday[1]=$yday[1];

					if(strlen(trim($yday[0]))==1)
			   			$yday[0] ="0".trim($yday[0]);

				$yesterday=trim($yday[0])."/".$yday[1]."/".$yday[2];
				$today=date('d/m/Y');

				   if($date==$today)
					  $pubdate=$today_;
					elseif($date == $yesterday)
					  $pubdate=$yesterday_;
					else
					  $pubdate=$date;


			$title=str_replace("||","'",$xml_readalsonew_news_res[0]['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);
			$rep_title=str_replace("…","...",$rep_title);

			$title=$rep_title;


		?>
			<tr><td align="left" height="25" valign="top"><a class="contblue1" href="view_fodarticle.php?id=<?=$xml_readalsonew_news_res[0]['newsitem_id']?>&lang=<?=$lang?>"><?=$title?></a>
				 <?if($pubdate!=""){?>
					&nbsp;<font class="grey"><?=$pubdate?></font>
				 <?}?>
		</td></tr>
		<?
			 $res_c[]=$exist;
		}

 	 }

}//for loop Ending

if(count($res_c)>0)
{
 ?>
<tr><td height="5"></td></tr>
 <?
   }
  }//if index Loop closing

}//Offset Ending
      $rt_qry="select * from menus where position='right' and language='$lang' order by version asc";
      $rt_res=$pg_sql->query_pass($rt_qry,"4");

      for($y=0;$y<count($rt_res);$y++)
      {
        $id=$rt_res[$y]['menu_id'];
        $desc=trim($rt_res[$y]['description']);
        $ext=pathinfo($rt_res[$y]['image']);
        $path=$ext['extension'];

        $dir="login/menu_images/".$id.".".$path;
        if(file_exists($dir))
        {
           $view=getimagesize($dir);
		   preg_match('/(width\=\")(.*?)(\")/i',$view[3],$match);
		    if($match[2]<50){
		      $image='&nbsp;&nbsp;<img src="'.$dir.'" width="120" align="absmiddle" height="60" border="0" alt="'.trim($rt_res[$y][alt_image]).'">';
		      $class="head3";
		      $align="left";
		    }else{
		      $image='<img src="'.$dir.'" border="0" width="120" align="absmiddle" height="60" alt="'.trim($rt_res[$y][alt_image]).'">';
		      if(trim($rt_res[$y]['menu_name'])!=""){
                if($display_style_==1) 
					 $class="heading3";
				else
					 $class="heading3new";
			  }
			   else
			     $class="";

		      $align="center";
	       }

        }else{
              $image=="";
              if($display_style_==1) 
	             $class="heading3";
			  else
	             $class="heading3new";
		      $align="left";
        }
        if(strstr($rt_res[$y]['url'],"feed_form"))
        {
		   $add_feed='<font class="'.$class.'">'.$add_feed_text.'</font>';
		}else{
		   $add_feed='';
		} 

        if(strstr($rt_res[$y]['url'],"rss_services"))
        {
           if($_REQUEST['cat_id']!="" && $_REQUEST['subcat_id']=="")
           		$flag_id="?cat_id=".$_REQUEST['cat_id'];
           elseif($_REQUEST['cat_id']!="" && $_REQUEST['subcat_id']!="")
           		$flag_id="?cat_id=".$_REQUEST['cat_id']."&subcat_id=".$_REQUEST['subcat_id'];
           else
              $flag_id="?flag=home";

        }else{
          $flag_id="";
        }

    ?>
    <tr align="left">
        <td align="<?=$align?>" valign="bottom" height="20" class="bgyellow"><?=$add_feed?>
        <?if(trim($rt_res[$y]['menu_name'])!=""){?>
          <a href="<?=$rt_res[$y]['url']?><?=$flag_id?>" class="<?=$class?>"  target="" title="<?=trim($rt_res[$y]['menu_name'])?>"><?=trim($rt_res[$y]['menu_name'])?></a>
	     <?}
	     if(isset($image))
	        echo '<a href="'.$rt_res[$y]['url'].'" target="_new" class="">'.$image."</a>";
	     if($desc!=""){?>
	     <br><font class='cont'><?=$desc?></font>
	     <?}?>
	     </td>
    </tr>
	<?
      unset($image);
     }

    ?>
      <tr><td bgcolor="<?=$bottom_bgcolor_style?>" height="100%">&nbsp;</td></tr>

</table>

<tr><td bgcolor="<?=$bottom_bgcolor_style?>">&nbsp;</td>
<td align="right" valign="bottom">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<?php

// For Previous && Next In Bottom Close To Footer && Top of Pagge Image
	if($page_name_ == 'index.php')
	{
  	    $prev = $offset - $limit;
  	    if($_REQUEST['offset']!=0){
			if($prev==-15)
			  $prev=0;
  		}

	  if($tot_exist_id!="")
	    $tot_ex="&tot_exist_id=".base64_encode($tot_exist_id);
	   else
	    $tot_ex="";

	   if($_REQUEST['cat_id']!="")
	   {
			 $catid_all="cat_id=".$_REQUEST['cat_id']."&";
		   if($_REQUEST['subcat_id']!="")
			 $subid_all="subcat_id=".$_REQUEST['subcat_id']."&";
	   }
	   if($prev>=0)
	   {
	    if($prev==0)
	      $off=0;
	    else
	      $off = $offset-$limit;

		echo "<td align='left'>&nbsp;&nbsp;&nbsp;<a href='index.php?".$catid_all.$subid_all."offset=".$off."&lang=".$lang.$tot_ex."'><img src='images/".$previous__."' border='0' alt='Prev'></a></td>";
	   }

	   $next = $offset + $limit;

	   if($next<$total_num)
	   {
		 $offset = $offset + $limit;
		 echo "<td align='right'><a href='index.php?".$catid_all.$subid_all."offset=".$offset."&lang=".$lang.$tot_ex."'><img src='images/".$next__."' border='0' alt='Next'></a>&nbsp;&nbsp;&nbsp;</td>";
	   }
     }

// List channles ..........
   if($page_name_ == 'list_channels.php')
	{
      $prev = $offset - $limit;
	  if($prev>=0){
		$off = $offset-$limit;
        echo '<td valign="top">&nbsp;<a href="list_channels.php?lang='.$lang.'&offset='.$off.'"><img src="images/'.$previous__.'" border="0" alt="Prev"></a>&nbsp;</td>';
	   }
	$next = $offset + $limit;
	if($next<$total_num){
		 $offset = $offset + $limit;
	     echo '<td valign="top" align="right">&nbsp;<a href="list_channels.php?lang='.$lang.'&offset='.$offset.'"><img src="images/'.$next__.'" border="0" alt="Next"></a>&nbsp;</td>';
	 }
  }
//List channels ending........
// List items FEEDS ..........
   if($page_name_ == 'list_items.php')
	{
      $prev = $offset - $limit;
	  if($prev>=0){
		$off = $offset-$limit;
        echo '<td valign="top">&nbsp;<a href="list_items.php?id='.$_REQUEST['id'].'&lang='.$lang.'&offset='.$off.'"><img src="images/'.$previous__.'" border="0" alt="Prev"></a>&nbsp;</td>';
	   }
	$next = $offset + $limit;
	if($next<$total_num){
		 $offset = $offset + $limit;
	     echo '<td valign="top" align="right">&nbsp;<a href="list_items.php?id='.$_REQUEST['id'].'&lang='.$lang.'&offset='.$offset.'"><img src="images/'.$next__.'" border="0" alt="Next"></a>&nbsp;</td>';
	 }
  }
//List item FEEDS  ending........
//List tags...

   if($page_name_ == 'list_tags.php')
	{
      $prev = $offset - $limit;
	  if($prev>=0){
		$off = $offset-$limit;
        echo '<td valign="top">&nbsp;<a href="list_tags.php?lang='.$lang.'&offset='.$off.'"><img src="images/'.$previous__.'" border="0" alt="Prev"></a>&nbsp;</td>';
	   }
	$next = $offset + $limit;
	if($next<$total_num){
		 $offset = $offset + $limit;
	     echo '<td valign="top" align="right">&nbsp;<a href="list_tags.php?lang='.$lang.'&offset='.$offset.'"><img src="images/'.$next__.'" border="0" alt="Next"></a>&nbsp;</td>';
	 }
  }
//
     if($page_name_ == 'search_results.php')
	 {
	 		$prev = $offset - $limit;

	 		if($prev>=0)
	 		{
	 		 $off = $offset-$limit;

	 		 echo "<td align='left' width='25%'>&nbsp;&nbsp;&nbsp;<a href='search_results.php?offset=".$off."&lang=".$lang."&title=".$new_title."&keyword=".$keyword."&pubdate=".$pubdate."&words=".$words."&olddate=".$oldest."&category=".$category."&source=".$source."&sort=".$sort."'><img src='images/".$previous__."' border='0' alt='Prev'></a></td>";
	 		}else{
	 		 echo "<td align='left' width='25%'>&nbsp;</td>";
	 		}
	 ?>
	 	  <td align="center" width="50%">&nbsp;
		      <a href="advsearch.php?lang=<?=$lang?>&title=<?=$new_title?>&keyword=<?=$keyword?>&pubdate=<?=$pubdate?>&words=<?=$words?>&olddate=<?=$oldest?>&category=<?=$category?>&source=<?=$source?>&sort=<?=$sort?>"><img src="images/<?=$new_search__?>" border="0" alt="newsearch"></a>
		  </td>

	 	<?
	 		$next = $offset + $limit;
	 		if($next < $total_news)
	 		{
	 		 $offset = $offset + $limit;
	 		  echo "<td align='right' width='25%'><a href='search_results.php?offset=".$offset."&lang=".$lang."&title=".$new_title."&keyword=".$keyword."&pubdate=".$pubdate."&words=".$words."&olddate=".$oldest."&category=".$category."&source=".$source."&sort=".$sort."'><img src='images/".$next__."' border='0' alt='Next'></a>&nbsp;&nbsp;&nbsp;</td>";
	 	    }else{
	 		  echo "<td align='left' width='25%'>&nbsp;</td>";
	 		}

     }
     if($page_name_ == 'quick_results.php')
	 {
		 if($total_item>0)
		 {

			$prev = $offset - $limit;
			if($prev>=0)
			{
			 $off = $offset-$limit;
			 echo "<td align='left'>&nbsp;&nbsp;&nbsp;<a href='quick_results.php?search=".$text."&offset=".$off."&lang=".$lang."'><img src='images/".$previous__."' border='0' alt='Prev'></a></td>";
			}else{
	 		  echo "<td align='left' width='25%'>&nbsp;</td>";
	 		}
	?>
	 		<td align="center" width="50%">&nbsp;
			    <a href="advsearch.php?lang=<?=$lang?>&title=<?=ucfirst(strtolower($text));?>"><img src="images/<?=$new_search__?>" alt="New Search" border="0"></a>
 			</td>
	<?
			$next = $offset + $limit;

			if($next<$total_num)
			{

			 $offset = $offset + $limit;
			 echo "<td align='right'><a href='quick_results.php?search=".$text."&offset=".$offset."&lang=".$lang."'><img src='images/".$next__."' border='0' alt='Next'></a>&nbsp;&nbsp;&nbsp;</td>";
			}else{
	 		  echo "<td align='left' width='25%'>&nbsp;</td>";
	 		}
	   }
  }

?>
</tr>
</table>
</td>
  <td align="right" valign="bottom" bgcolor="<?=$bottom_bgcolor_style?>"><a href="#Top"><img src="images/<?=$top__?>" alt="<?=$top_alt__?>" width="120" height="15" border="0"></a></td>
</tr>

Return current item: News Manager - RSS aggregator