Greenguy's Board


Go Back   Greenguy's Board > Programming & Scripting
Register FAQ Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
Old 2006-06-04, 01:14 PM   #1
WarBot
If something goes wrong at the plant, blame the guy who can't speak English
 
WarBot's Avatar
 
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
WarBot is offline   Reply With Quote
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:51 AM.


Mark Read
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc