Login   Register  
PHP Classes
elePHPant
Icontem

File: newest.html

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of nanou morgan  >  noticeboard  >  newest.html  >  Download  
File: newest.html
Role: ???
Content type: text/plain
Description: Show entries recently added
Class: noticeboard
Author: By
Last change:
Date: 2001-02-11 09:21
Size: 3,439 bytes
 

Contents

Class file image Download
<?

include  ('template.inc');
include  ('variable.inc');


/*
------------------------------------------------------------------------
* Nanou Morgan                  Web  			http://www.vmedia.com.au            
* NoticeBoard version 1.1		Personal Web	http://www.nanou.com.au
* January 2001					Email: 			nanou@nanou.com.au
________________________________________________________________________

*/


$title ="List Most Recent Postings";
$today = date("Ymd");



$content .="<P><font face=\"Helvetica,Arial,Geneva\"><font size=\"2\"><b>$title</b></font><br>

	<FORM NAME=\"Newlist\" ACTION=\"$PHP_SELF\" METHOD=POST>
	Display the latest entries that are <select name=\"Length\" size=\"1\">";

if ( (!isset($Length)) ||($Length ==01) ){$Length=01;$content .= "<option value=\"01\" selected>1 month</option><option value=\"02\">2 month</option><option value=\"03\">3 month</option>";}
elseif ($Length ==02){$content .= "<option value=\"01\">1 month</option><option value=\"02\" selected>2 month</option><option value=\"03\">3 month</option>";}
elseif ($Length ==03){$content .= "<option value=\"01\">1 month</option><option value=\"02\">2 month</option><option value=\"03\" selected>3 month</option>";}


$content .="</select> Old. <input type=\"submit\" name=\"submit\" value=\"Go\"><br><hr><ul>";

$lines = file ($noticeB_file);
rsort($lines);

$i=0;

for ($L=0; $L< count ($lines);$L++){
	

	
	$entry = explode("\t" , $lines[$L]);
for ($k=0; $k<count($entry); $k++) {

	
	$digitM =substr("$today",4,2);
	$YYYY =substr("$today",0,4);
	
	$digit=$digitM - $Length;
	
	
	
	if($digit <= 00){ $YEAR = $YYYY - 1;$MONT= 12 + $digit;}
	else          {$YEAR = $YYYY;  $MONT= $digit;}
	
	if ($MONT <10){$MONTH ="0".$digit;} else {$MONTH =$MONT;}
	
	$EndTime = "$YEAR"."$MONTH".date("d");
	
	if ($entry[0] > $EndTime ){ 
						$CategoryN = strtr($entry[2], "_", " ");
						$AN =substr("$entry[0]",0,4);
						$MOIS =substr("$entry[0]",4,2);
						$JOUR =substr("$entry[0]",6,2);	
						$entry[6]=stripslashes($entry[6]);
				$content.= "<font face=\"Helvetica,Arial,Geneva\"><font size=\"2\"><b>$CategoryN</b>: 
				<a href=\"list.html?Category=$entry[2]&ID=$entry[1]\">$entry[6]</a> - <i>(Posted on : $JOUR-$MOIS-$AN)</i></font></font><br>";
					$i++;break;}
					
					else {$content.="";}
				}
				
				
		 }
	
	if (($i ==0)&&($Length==01)){$content.="There are no entries that are one month old";}
	if (($i ==0)&&($Length==02)){$content.="There are no entries that are two months old";}
	if (($i ==0)&&($Length==03)){$content.="There are no entries that are three months old";} 
	$content.="</ul></form>";	 
		 
		 






/*  parse to template */ 


$t = new Template( $path);
                                  // create a template object named $t 


$t->set_file( "MyFileHandle", "$template");
                                  // set MyFileHandle = our template file 
                                                                    
$t->set_var(array( "TITLE" => $title,
					"FOOTER" => $bot,
				   "CONTENT" =>  $content));
                                  

                                  // set template variable 
$t->parse( "MyOutput", "MyFileHandle"); 
                                  // set template variable MyOutput = parsed file 
$t->p( "MyOutput");  // output the value of MyOutput (our parsed data) 


?>