sir.jones
01-10-2010, 04:39 PM
Hi All, nice to meet you :)
i Looking for some help here,
I have config.file where is as file configuration to another file, and inside are:
<?php
$fn[0]["short"] = "file-name.txt"; $fn[0]["long"] = "file name";
$fn[1]["short"] = "1_file-name.txt"; $fn[1]["long"] = "1 file name";
?>
What that I want to:
1. $fn[0], $fn[1], etc.., as auto increasing
2. "file-name.txt", "1_file-name.txt", etc.., as file name from a directory, i want it auto insert.
3. "file name", "1 file name", etc.., is auto split from "file-name.txt", "1_file-name.txt", etc..,
I was try to handle it with atomically insert using small php code, but i not sure it's done :confused:, because it just echoing and than how to split it?
here the e.g. code:
$path = ".";
$dh = opendir($path);
//$i=1;
$i= 0;
while (($file = readdir($dh)) !== false) {
if($file != "." && $file != "..") {
echo "\$fn[$i]['short'] = '$file'; $fn[$i]['long'] = '$file(splited)';<br />"; // Test
$i++;
}
} closedir($dh);
because when this code include to config.php file won't work properly
so Every idea would be welcome and could be help me, Thank You :thumbsup:
i Looking for some help here,
I have config.file where is as file configuration to another file, and inside are:
<?php
$fn[0]["short"] = "file-name.txt"; $fn[0]["long"] = "file name";
$fn[1]["short"] = "1_file-name.txt"; $fn[1]["long"] = "1 file name";
?>
What that I want to:
1. $fn[0], $fn[1], etc.., as auto increasing
2. "file-name.txt", "1_file-name.txt", etc.., as file name from a directory, i want it auto insert.
3. "file name", "1 file name", etc.., is auto split from "file-name.txt", "1_file-name.txt", etc..,
I was try to handle it with atomically insert using small php code, but i not sure it's done :confused:, because it just echoing and than how to split it?
here the e.g. code:
$path = ".";
$dh = opendir($path);
//$i=1;
$i= 0;
while (($file = readdir($dh)) !== false) {
if($file != "." && $file != "..") {
echo "\$fn[$i]['short'] = '$file'; $fn[$i]['long'] = '$file(splited)';<br />"; // Test
$i++;
}
} closedir($dh);
because when this code include to config.php file won't work properly
so Every idea would be welcome and could be help me, Thank You :thumbsup: