Jump to content


Photo

Quote of the day from .txt file


  • Please log in to reply
3 replies to this topic

#1 member

member
  • Members
  • PipPipPip
  • Advanced Member
  • 58 posts

Posted 24 September 2006 - 07:01 PM

Hi,

just wanted to ask u if u know the code to load a text from a .txt file which will contain some html to load it as a "quote of the day"

Thank You very much, ur help is most appreciated.

#2 xyn

xyn
  • Members
  • PipPipPip
  • Advanced Member
  • 779 posts
  • LocationNorthampton

Posted 24 September 2006 - 07:18 PM

Yes, fwrite(); fclose(); www.php.net and then...
include("quote_of_the_day.txt");
making sure the have chmodded it to 0777

#3 member

member
  • Members
  • PipPipPip
  • Advanced Member
  • 58 posts

Posted 24 September 2006 - 07:25 PM

sorry new to php, don't have a clue, do i copy paste this code? pls include the php tags thank you.

#4 slanton

slanton
  • Members
  • PipPip
  • Member
  • 27 posts
  • LocationNew Zealand

Posted 24 September 2006 - 07:56 PM

What about
<?php
$filename = "quotes.txt";
$file = file($filename);
$file=shuffle($file);
echo $file[0];
?>
just remember to put each quote on a new line in the txt file





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users