Pull by DATE and not just LATEST entries

I have this simple news article program I have been working on… Works great for the most part but I have a question I keep stumbling on being fairly new at php…

This code below pulls articles from a summary data file and it includes the latest xx amount of articles I declare in the conf file… I need the conf file for other various items but I still want to keep a count of how many are displayed…

What I am having issues with is adding a date and more specifically a year… I would like to show xx amount of articles from the year 2010 for instance… (i.e. The latest 100 articles from year 2010)… Right now this shows the latest 100 from current day to previous…

Thanks in advance for any help… I know I have to declare a date variable but my syntax keeps faulting…
Like I said, i’m a noob… :wink:

[php]<?

    require('config.php'); 

$filename = "article_summary.html";

#- open article summaries
if(file_exists($filename)){
	$fh = fopen($filename, "r");
	$old_news = fread($fh, filesize($filename));
	fclose($fh);
}


#- get first X articles
$articles = explode("<!--ARTICLE-->", $old_news);

$i=0;
foreach ( $articles as $article ){
	if(count($articles)>$i){
		if($max_latest >= $i++){
			print $article;
		}
	}
}

?>[/php]

CONFIG.PHP[php]<?

$summary_template = “t_summary.html”;

$article_template = “t_article.html”;

$max_summary = 100;

$max_latest = 100; $password = “xxxxxx”;

?>
[/php]

by the way…

the file article_summary.html has the date in the filename that is created and would have to be pulled from that since I am accessing that file for the articles to be displayed… Unless someone has a better idea…

thanks again

article_summary.html

[code]
Topeka, Wichita Kansas Sees Destruction of Illegal Gambling Machines

According to the Associated Press, a large slew of gambling machines had been confiscated and destroyed pursuant to Kansas law. Over the past week, demolition crews took to the destruction of several machines from both Wichita and Topeka, Kansas.

Deadwood’s gambling tax distribution

The State of South Dakota collects an 8 percent tax on the adjusted gross revenue from gambling. Forty percent of that goes to the state Department of Tourism, 10 percent goes to Lawrence County and the remaining 50 percent stays in the South Dakota Commission on Gaming fund.
[/code]

Is this in the right forum area or should I have posted this in General Help? If I did post in wrong area can someone then move it to the right one? I do not want to aggravate anyone and create another topic so we have double entries…

I still consider myself a beginner so I was not sure…
Thanks again for this site has saved my but before

Sponsor our Newsletter | Privacy Policy | Terms of Service