Forums Archive Index > Cool free scripts > Including a .txt file
Date: 17 Oct 2005 12:42 pm
I am making a site for a small radio station. The software used to play out the songs on the station has a facility that uploads the name of the currently playing song via ftp as a text file (onair.txt).
I want to be able to include the name of the currently playing song from that text file into the ticker, so for example...
Code:
v_content=[
['','Welcome to Demon FM',],
['','Currently Playing: <php include(onair.txt); ?>',],
['','Don't forget to enter our competition to win a holiday',],
];
Now as you may have guessed from the fact I am posting to ask for help, just using a php include doesn't work. So, can anyone help me out?
Thanks in advance
Date: 17 Oct 2005 5:04 pm
Well, if "onair.txt" is just a simple file with only one line of text (e.g. the artist and the title of the song), you can make it very simple like this:
Code:
v_content=[
['','Welcome to Demon FM',],
['','Currently Playing: <?php readfile("onair.txt"); ?>',],
['','Don't forget to enter our competition to win a holiday',],
];
Please make sure you use the correct path to the "onair.txt" file. Also make sure the file containing the V-NewsTicker script has an appropriate extension for the PHP code to work (e.g. probably v_newsticker.php).
Date: 18 Oct 2005 6:58 am
Worked a treat.
Thanks very much :)