hello world...
i'm new to PHP (this is my second code) and i would like to learn this language.
Now I'have experience with actionscript and mybe my current code is not working because i'm fllowing the same code architecure.
The problem is:
I want to read the content inside a folder (on server) and write this information into a file.
image_fotos
[INDENT]
[+]somefolder
[/INDENT]
[INDENT][INDENT]
[-]file.jpg
[-]file2.jpg
[-]bleble.jpg
[-]tralala.png
[-]lolo.swf
[/INDENT]
[+]someotherfolder
[/LIST][/INDENT]
[INDENT][INDENT]
[-]fil25e.jpg
[-]file28.jpg
[-]bleble78.jpg
[-]tralalagre.png
[-]lolo123.swf
[/INDENT][/INDENT][/LIST]
Yesterday i made this but looks like my theory was wrong...
<?php
$dir='/images_photos';
$folders =scandir($dir);
for($i=0;$i<=count($folders);$i++){
${"path".$i}="/$dir/$folders[i]/$folders[i].xml";
${"img_".$folders."".$i}=scandir($folders[i]);
${"str_".$folders."".$i}="<all_images>";
for($j=0;$j<=count(${"img_".$folders."".$i});$j++){
${"str_".$folders."".$i}.="<image name=".${"img_".$folders."".$i}[j]."/>";
}
${"str_".$folders."".$i}.="</all_images>";
${"open".$i} = fopen(${"path".$i}, 'w');
${"write".$i} = fwrite(${"open".$i}, stripslashes(${"str_".$folders."".$i});
if(${"write".$i}){
echo "&thefile".$i."=".${"path".$i}."&";
}
}
?>
how can i fix this????
Thanks
Pepe