Re: script stoped working over christmas ?



On Dec 29, 3:23 am, sat_r...@xxxxxxxxxxx ("Joker7") wrote:
Can anyone see why this has stopped working...
latest.php is used with <?
include("/home/sever2/public_html/teaup/article/article_summary.php") ?> to
show the latest news articles.

Cheers
Chris

config.php
<?php
$max_summary = 6;
$max_latest = 7;
$summary_template = "t_summary.tp";
$article_template = "t_article.tp";
$password = "password";
?>

latest.php
<?php

require('config.php');

$filename = "article_summary.php";

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

#- get article
$articles = explode("<!--ARTICLE-->", $old_news);
$i=0;
foreach ( $articles as $article ){
if(count($articles)>$i){
if($max_latest >= $i++){
print $article;
}
}
}

?>

When I have problems with no data, it either hangs (where you have to
push stop, an endless loop) or some condition is not met and it falls
through without output.

I would plug in a echo 'point a reached.<br>'; or something similar at
key places and see what expected you get back or don't. From there
you can debug.

Looking at your script, a quick guess I would say it is something in
the count($articles) or $max_latest lines near the bottom.
.



Relevant Pages