|
|
|
|
|
|
![]() |
#1 |
If something goes wrong at the plant, blame the guy who can't speak English
Join Date: May 2006
Posts: 306
|
PHP help needed
Hi, I have a little problem figuring out what to do here. First let me explain my goal.
To display 1 tgp gallery, then 1 free site, then 1 tgp gallery, then 1 free sites, and on and on until there are no new tgp galleries or free sites. Im pulling the tgp galleries from tgplinks.txt and the free sites from fslinks.txt. heres a snippet from one of those txt files: http://www.tgpgallery.com/gallery-01.html||A TGP Gallery Description Goes Here||Teen| http://www.tgpgallery.com/gallery-02.html||A TGP Gallery Description Goes Here||Babe| http://www.tgpgallery.com/gallery-03.html||A TGP Gallery Description Goes Here||Hardcore Sex| The empty spaces are for future use. Heres the php code im using to do this: <?php $fslinks=file("fs-Mixed.txt"); $tgplinks=file("tgp-Mixed.txt"); $numfs=count($fslinks); $numtgp=count($tgplinks); if($numfs>=$numtgp){ for($i=0;$i<$numfs;$i++){ $fs=explode("|",$fslinks[$i]); $tgp=explode("|",$tgplinks[$i]); print(" <a href=$fs[0]>$fs[4]</a><br>$fs[2]<br><br>\n <a href=$tgp[0]>$tgp[4]</a><br>$tgp[2]<br><br>\n"); } }elseif($numtgp>=$numfs){ for($i=0;$i<$numtgp;$i++){ $fs=explode("|",$fslinks[$i]); $tgp=explode("|",$tgplinks[$i]); print(" <a href=$tgp[0]>$tgp[4]</a><br>$tgp[2]<br><br>\n <a href=$fs[0]>$fs[4]</a><br>$fs[2]<br><br>\n"); } } php?> This code does great if there are the same number of lines on both txt files. But if, for example, tgplinks.txt has 50 lines and fslinks.txt has only 20 then i get a wierd looking page. It basically looks like this: TGP gallery, blah blah Free Site, blah blah TGP gallery, blah blah TGP Gallery, blah blah TGP Gallery, blah blah The little snippet doesnt realize I want it to stop entering the fslinks.txt stuff and just go with the tgplinks.txt when it runs out. So... my question is, can anyone tell me how to fix this? I need to tell php that once the lines run out on fslinks.txt (or tgplinks.txt) that it should just leave the line out instead of filling the info in with blanks like this <a href="http://blahblah">Whatever TGP</a> blah blah<br><br>/n <a href=""></><br><br>/n I think through all the rambling I got the correct question out there. Anyone know how to fix this?
__________________
Submit Your TGP Galleries |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | Rate This Thread |
|
|