Closed Thread Icon

Topic awaiting preservation: Things keep going wrong (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=12672" title="Pages that link to Topic awaiting preservation: Things keep going wrong (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Things keep going wrong <span class="small">(Page 1 of 1)</span>\

 
Trigger
Paranoid (IV) Inmate

From:
Insane since: Jun 2002

posted posted 03-29-2003 23:28

Ok.. im makeing a webjournal site, very simplistic located at http://www.the-bronze.net/test/ atm,
its my girlfriend and Myselfs website,
we plan to both write entrys into it,

but i've got a few problems with my code that I cant quite iron out, because im still very new to php
heres my code
<BLOCKQUOTE><FONT face="Verdana, Arial">code:</font><HR><pre>
<?

ERROR_REPORTING(E_ALL);


$lines = file ('db/blog.dat');

$numperpage = 2; //2 news items per page
$linecounter = -0;
$pagecounter = 0;
$tempcounter = 0;

foreach ($lines as $line_num => $line) {

while($linecounter < $numperpage)
{

// explode into array
$lineinfo = explode("

butcher
Paranoid (IV) Inmate

From: New Jersey, USA
Insane since: Oct 2000

posted posted 03-30-2003 01:18

Tigger

Just looking quickly you need to reverse your foreach and while loops so that the foreach is inside the while. Doing this will cause you to have to rework your Go To: page number bit, but it will allow the loop to go through all the lines of your dat file. The way it's written right now, the while loop just continues to use the same line of data.

Also to reverse the order of the way the entries are displayed, use array_reverse().

$lines = array_reverse($lines); //Make them last to first - newest to oldest

If I didn't explain myself well enough, let me know and I'll try again.

Hope this helps.



-Butcher-

Trigger
Paranoid (IV) Inmate

From:
Insane since: Jun 2002

posted posted 03-30-2003 08:43

Butcher, I think I understand what your saying'.. I'll have a goat it, and get back to you

Thanks
Trigger

Trigger
Paranoid (IV) Inmate

From:
Insane since: Jun 2002

posted posted 03-30-2003 10:07

Worked like a charm, just got to fix up my goto page and I should be sorted.. I hope

Thanks agian
Trigger

« BackwardsOnwards »

Show Forum Drop Down Menu