-
October 21st, 2004, 12:02 AM
#1
-
October 26th, 2004, 03:06 PM
#2
Senior Member
I found a way of doing just what he whanted but i have yet, another problem.
What i did was the Include again, but this time iv chanded the quote.txt file and made HTML code inside to insert <br><br> after each line so that evrything looks nice and pretty, the damm problem is that the boot has to had after each quote ppl make on the IRC channel <br><br> to the end of the frase automaticly..now this envolves C++ since the bot was "ritten" for UNIX systems but a Windows port was also concidered, i compiled it and works..but i need the piece of code that makes the boot had that to the end of the frases.
The bot code is here http://darksun.com.pt/mbot/
Thanx for any help is apreciated!
-
October 26th, 2004, 03:20 PM
#3
Why not code something like:
Code:
<?php
$quote_file = fopen ("quotes.txt","r");
while(!feof($quote_file)) {
$line = fgets($file,1024);
print($line."<br>\n");
}
fclose($quote_file);
?>
Oliver's Law:
Experience is something you don't get until just after you need it.
-
October 26th, 2004, 05:34 PM
#4
Originally posted here by Owmen
I found a way of doing just what he whanted but i have yet, another problem.
What i did was the Include again, but this time iv chanded the quote.txt file and made HTML code inside to insert <br><br> after each line so that evrything looks nice and pretty, the damm problem is that the boot has to had after each quote ppl make on the IRC channel <br><br> to the end of the frase automaticly.
You don't need to do that, leave it as newlined file ends.
PHP Code:
$quotes=file_get_contents("quotes.txt");
$arr = split(PHP_EOL, $quotes);
for ($i=0; $i<sizeof($arr); $i++)
{
echo $arr[$i]."<br>".PHP_EOL;
}
Almost the same, but more portable, and faster than fopen/fgets.
Chris Shepherd
The Nelson-Shepherd cutoff: The point at which you realise someone is an idiot while trying to help them.
\"Well as far as the spelling, I speak fluently both your native languages. Do you even can try spell mine ?\" -- Failed Insult
Is your whole family retarded, or did they just catch it from you?
-
October 26th, 2004, 06:13 PM
#5
Senior Member
Thanx ppL!!!! really alot
-
October 26th, 2004, 06:25 PM
#6
Senior Member
-
October 27th, 2004, 12:30 AM
#7
Well, PHP_EOL is new as of PHP 4.3.10, so it's probably not in your install. You can define it with:
PHP Code:
define('PHP_EOL', '\n'); // Unix end of line
or
PHP Code:
define('PHP_EOL', '\r\n'); // Windows end of line
depending on which OS your host runs. Also note once you've built the array, you could randomly pick a quote to display.
Chris Shepherd
The Nelson-Shepherd cutoff: The point at which you realise someone is an idiot while trying to help them.
\"Well as far as the spelling, I speak fluently both your native languages. Do you even can try spell mine ?\" -- Failed Insult
Is your whole family retarded, or did they just catch it from you?
-
October 28th, 2004, 08:01 PM
#8
Senior Member
Itsss aliveee its aliveeeee !!! (mean it works !!)
Thanx, like... ALOT!!!!!!
Cheers!!!
-
November 1st, 2004, 05:23 PM
#9
Originally posted here by chsh
Almost the same, but more portable, and faster than fopen/fgets.
Ah. Didn't know that. I just coded mine after reading the PHP manual for about 2 minutes (hint...hint...hint.... )
Oliver's Law:
Experience is something you don't get until just after you need it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|