Jump to content
xisto Community
Sign in to follow this  
iGuest

creating a file

Recommended Posts

or it is better way to create xml file with such structure:<?xml version="1.0" encoding="UTF-8"?><player showDisplay="yes" showPlaylist="no"><song path="mp3/Absent_No control.mp3" title= "Absent- No control" /></player>i need that scrit read a directory, remove last for symbols (.mp3) and create a file with such structure. in this file only changing filename and filetitle, who is generated from filename

Share this post


Link to post
Share on other sites

<?php$default_dir = "./ist-04";$fvardas = 'playlist.xml';if(!($dp = opendir($default_dir))) die("Nepavyksta atidaryti katalogo $default_dir.");while($file = readdir($dp) ) $filenames[] = $file;closedir($dp);$handle = fopen($fvardas, 'w+');// Write $somecontent to our opened file. if (file_put_contents($handle, $fvardas) === FALSE) { echo "Cannot write to file ($fvardas)"; exit; }sort($filenames);for($i=0; $i < count($filenames); $i++)if($filenames[$i] != '.' && $filenames[$i] != '..'){$last=substr($filenames[$i], 0, -4);echo $last; ?><br><?;}?>this script is not finishedcan anyone tell me how to do the xml file, with structure who i wroted in post before ?

Share this post


Link to post
Share on other sites

No idea about the XML, but you can write the " and symbols in php using

" and
escape sequences. The /, <, and > symbols don't require escape sequesnces, meanign you can just put the symbols in.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.