failing php generating XML!

apotropaics_at_gmail.com
Date: 02/24/05


Date: 24 Feb 2005 13:01:55 -0800

I'm trying to open a directory and create an XML file based on the
folder & file structure. Here is my code:

function imagefolder($imagedir,$level) {

if ($dir = opendir($imagedir)) {
        $xmlcode = "";
        $spacer = str_repeat(' ',$level);
        while (($file = readdir($dir)) != false ) {
                                if ($file != ".") {
                                        if ($file != "..") {
                                               if (is_dir($dir ."/". $file)) {
                                                        echo("level is $level and file is $file and dir is $dirS");
                                                        $xmlcode = $xmlcode + $spacer + "<group id='".$level."'
title='".xmlReady($file)."'>".imagefolder($dir ."/".
$file,$level+1)."</group>\n";
                                                }
                                                   else {
                                                                if (substr(strtolower($file,-3) == 'jpg')) {
                                                                $imageinfo = getimagesize($file);
                                                                $width = $imageinfo[0];
                                                                $height = $imageinfo[1];
                                                                $size = round(filesize($file)/1024,1).' KB';
                                                                $xmlcode = $xmlcode + $spacer +"<image id='".$level."'
title='".xmlReady($file)."' src='".$imagedir.$file."'
width='".$width."' height='".$height."' comments='".xmlReady($file)."'
/>\n";
                                                                }

                                                }
                                        }
                                }
        }
        closedir($dir);

}
        return $xmlcode;
}

function jsalert($msg) {
echo ("<script language='javascript'>");
echo ("alert('".$msg."');");
echo ("</script>");

}

function xmlReady($str){
$str = str_replace("&", "&amp;",$str);
$str = str_replace("<", "&lt;",$str);
$str = str_replace(">", "&gt;",$str);
$str = str_replace("'","&apos;",$str);
$str = str_replace("\"", "&quot;",$str);
return $str;
}

////////////////////////////////////////////////////////////// DISPLAY
XML

header("Content-type: application/xml");
echo("<?xml version='1.0'?>\n");
echo("<catalog>\n");
//echo(display_children(0,0,$dbTable));
echo(imagefolder("./",0));
echo("</catalog>");

can anybody help me with this??? The output is basiclly just <catalog>
</catalog> sometimes I can get it to read just the folder and they do
display well inside of catalog elements.



Relevant Pages

  • Re: Question for PapaJohn
    ... add a new folder named that under the Shared folder. ... your own and edit the xml file to change papajohn to alisyn... ... Download the Starter Kit for XP or the Starter Kit for Vista and unzip the ... If you did this while Movie Maker was open, ...
    (microsoft.public.windowsxp.moviemaker)
  • Re: Move csv file from one folder to another when output should be xml file
    ... and stored in in the Out folder as a XML file with all the records from the ... The difference is that the output XML file should be according to an example ... Most of the differences between the flat file schema and the output schema ...
    (microsoft.public.biztalk.general)
  • Re: IMF and location of XML file?
    ... Files\Exchsrvr\bin\MSCFV2" folder. ... IMF Tune - Unleash the Full Intelligent Message Filter Power ... I have seen multiple references that state that the XML file needs to be ... "MSExchange.UceContentFilter.dll" file in the new subfolder need to be ...
    (microsoft.public.windows.server.sbs)
  • Re: IMF KB9077747
    ... Do you see anything in the application event log after adding the xml file in \bin\mscfv2 folder? ... Also note - If you've setup IMF to update automatically from Microsoft Update, it creates folders/sub-directories in the \bin\MSCFV2 folder for every new update. ... The XML file needs to be copied manually to the newly created folder. ... weight filter XML file and restart the virtual SMTP server it stops working ...
    (microsoft.public.exchange.admin)
  • Re: Pain in... Loop through work flow with a recursive FSO loop
    ... > dim fso, folder, subFolder ... > dim fso, folder, subFolder, folderCounter ... > Function ShouldILoop ... > processes the XML file. ...
    (microsoft.public.sqlserver.dts)