GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Programmers or any others i got a ? (https://gfy.com/showthread.php?t=370315)

Juicy D. Links 10-11-2004 01:11 PM

Programmers or any others i got a ?
 
K

Need to setup a page that will grab the contents of file and list it . The page it grabs is a txt file....

How can i do this? Use a SSI includes?

Johny Traffic 10-11-2004 01:12 PM

I dont know sorry, but can I put my sig in one of Juicys threads anyway please :glugglug

Juicy D. Links 10-11-2004 01:12 PM

Quote:

Originally posted by Johny Traffic
I dont know sorry, but can I put my sig in one of Juicys threads anyway please :glugglug
sure

psili 10-11-2004 01:12 PM

a simple php page:

$fileToGrab = '/path/to/file.txt';

print ( implode('',file($file) );



if you don't need any special formatting.

Juicy D. Links 10-11-2004 01:13 PM

Quote:

Originally posted by psili
a simple php page:

$fileToGrab = '/path/to/file.txt';

print ( implode('',file($file) );



if you don't need any special formatting.

thanks man ill test it now.

psili 10-11-2004 01:14 PM

make sure you make note of how i didn't reference the second "file" variable correctly becuase I'm retarded


$fileToGrab = '';
print (implode('',file($fileToGrab)));

Johny Traffic 10-11-2004 01:16 PM

Quote:

sure
I'll be honest I didnt really even understand the question, let alone, know the answer :)

Juicy D. Links 10-11-2004 01:30 PM

Quote:

Originally posted by psili
make sure you make note of how i didn't reference the second "file" variable correctly becuase I'm retarded


$fileToGrab = '';
print (implode('',file($fileToGrab)));

works like a charm.... now how do i get the output to be one item per line?

Juicy D. Links 10-11-2004 01:31 PM

PHP Code:

<?php 
$fileToGrab 
'juicy.txt';
print (
implode('',file($fileToGrab)));
?>


thats what i got

psili 10-11-2004 01:35 PM

You dumping to an HTML window ?

Try this:

$fileToGrab = "juicy.txt";

print ( preg_replace("/\n/","<br>",implode("",file($fileToGrab))) );



might not be the most elegant, but it should work.

swedguy 10-11-2004 01:40 PM

Quote:

Originally posted by psili
You dumping to an HTML window ?

Try this:

$fileToGrab = "juicy.txt";

print ( preg_replace("/\n/","<br>",implode("",file($fileToGrab))) );



might not be the most elegant, but it should work.

Or even easier, use nl2br()



<?
print nl2br(implode("",file("juicy.txt")));
?>

psili 10-11-2004 01:41 PM

Quote:

Originally posted by swedguy
Or even easier, use nl2br()



<?
print nl2br(implode("",file("juicy.txt")));
?>

See..... That's lovely right there.

Juicy D. Links 10-11-2004 01:43 PM

niceeeeeeeeee

Now ill set up a cron job to update the php file.


All times are GMT -7. The time now is 12:40 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123