Hi all i wonder how i can output html code from with in php code after i write to a file and the .txtfile get created?
My current code uses require 'config.txt'; method to out put the following html code
I wonder how i can avoid using require 'config.txt' and be able to output the above html from within my main code?Furthermore, i want to place .txt file name dynamically where it is inside $filename variable instead of above 733476022.txt. I be happy if an expert help me out here.ThanksCode:<html> <head> <title> MP3 Player Music and Videos</title> </head> <body> </td> <td align="center" width="60%"> <object type="application/x-shockwave-flash" data="mp3player.swf?playlist=733476022.txt" width="280" height="280" wmode="transparent"> <param name="movie" value="mp3player.swf?playlist=ram.txt" /> <param name="wmode" value="transparent" /> </object> </td> </body> </html>
Code:<?php $url[1] = "http://localhost/flash_mp3_player/mp3/01 - Saracha.mp3"; $url[2] = "http://localhost/flash_mp3_player/mp3/13 - Gar Aya.mp3"; $url[3] = "http://localhost/flash_mp3_player/mp3/Soroush - Yeh Donya - 02 Shoghe Nafas.mp3"; $mycontent = ""; if (isset($_GET["sid"])) { $allsid = explode (",",$_GET["sid"]); $mycontent = array(); foreach ($allsid AS $value) $mycontent[] = $url[$value]; } echo $mycontent; $filename = time() . ".txt"; $handle = fopen ($filename,"w+"); if ($handle) { if (fwrite ( $handle,implode("\r\n",$mycontent)."\r\n") ) { echo "FILE IS WRITTEN SUCCESSFULLY"; } else { echo "ERROR IN WRITING TO FILE"; } fclose ($handle); } else { echo "ERROR IN OPENING FILE"; } require 'config.txt';===> i want output it from within main script and avoide useing require 'config.txt'; method! ?>




Reply With Quote