PHP News Script Trouble

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
m0by
Forum Newbie
Posts: 4
Joined: Fri Oct 18, 2002 2:14 am
Location: Earth

PHP News Script Trouble

Post 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 ...
?>
Last edited by m0by on Fri Oct 18, 2002 6:10 am, edited 1 time in total.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Where does $fd come from?

Mac
User avatar
m0by
Forum Newbie
Posts: 4
Joined: Fri Oct 18, 2002 2:14 am
Location: Earth

Post by m0by »

fopen the document file. :oops:
Post Reply