Page 1 of 1

PHP News Script Trouble

Posted: Fri Oct 18, 2002 2:14 am
by m0by
I'm having trouble getting ALL the entries to show up. The only entry that shows up is the first one and it show it however many entry totals their are. Any help would be great. Thanks!

Code: Select all

... other stuff ...
	var $pp = 5; # posts per page
	var $total = 0; # total number of entries
... other stuff...
		$file_name = $this->root_dir . $this->os_slash . 'news' . $this->os_slash . 'news.dat';
		$fd = file($file_name);
		$this->total = sizeof($fd);
... other stuff ...
		$entry = ( !isset($_GETї'entry']) ) ? 0 : $_GETї'entry'];
... other stuff ...
			$start = $this->total - 1 - $entry;
			$finish = $this->total - $entry - $this->pp;

			if ($finish <= 0) {
				$finish = -1;
			} # end if

			for ($i = $start; $i > $finish; $i--) {
 				list($news_id, $news_timestamp, $news_title, $news_msg) = explode('ยก', $fdї$i]);
				$data = array(
				'id' => stripslashes($news_id),
				'time' => $this->create_date(stripslashes($news_timestamp), $pyro_configї'timezone']),
				'title' => stripslashes($news_title),
				'msg' => substr(stripslashes($this->format_url($this->format_smile($news_msg))), 0, 150)
				);
				$dataї'msg'] = (strlen($dataї'msg']) > 149) ? $dataї'msg'] . '...' : $dataї'msg'];
				$CLASSї"pyro_template"]->register_vars("page_all_news", array(
					"id" => "\$dataїid]",
					"time" => "\$dataїtime]",
					"title" => "\$dataїtitle]",
					"msg" => "\$dataїmsg]"
				));

				if ($this->posts <= $this->pp) {
					$this->posts++;
					$all_news  .= $CLASSї"pyro_template"]->pre_parse("page_all_news");
				} else { # end if
					$all_news = $CLASSї"pyro_template"]->pre_parse("page_no_data");
				} # end else

			} # end for
... other stuff ...
?>

Posted: Fri Oct 18, 2002 6:04 am
by twigletmac
Where does $fd come from?

Mac

Posted: Fri Oct 18, 2002 6:11 am
by m0by
fopen the document file. :oops: