The following code generates a new php file playlist.php which contains the code as in $start $result variable

$path = "./files/";
$path2="http://".$_SERVER['SERVER_NAME'].dirname($_SERVER["PHP_SELF"])."/files/";
//echo $path2;
$folder = opendir($path);
$start="<asx version='3.0'>\n<title>Example ASX playlist</title>";
$Fnm = "./playlist.php";
$inF = fopen($Fnm,"w");
fwrite($inF,$start."\n");
while( $file = readdir($folder) ) {
 if (($file != '.')&&($file != '..')&&($file != 'index.htm')){
 $result="<entry>\n<title>$file</title>\n<ref href='$path2$file'/>\n<param name='image'     value='preview.jpg'/>\n</entry>\n";
     fwrite($inF,$result);
 }
}
fwrite($inF,"</asx>");
closedir($folder);
fclose($inF);

I want to generate the same code in the same file which contains this code on a specified line number is this possible ?

The above php script generates the following code on a new file

 <asx version='3.0'>
        <title>Example ASX playlist</title>
        <entry>
        <title>sintel_trailer1.mp4</title>
        <ref href='/files/sintel_trailer1.mp4'/>
        <param name='image' value='preview.jpg'/>
        </entry>
        </asx>

Recommended Answers

All 2 Replies

Member Avatar for diafol

I want to generate the same code in the same file which contains this code on a specified line number is this possible ?

Huh?

I want to append this to a specific line
for example at line 12

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.