help on directory helper - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: help on directory helper (/showthread.php?tid=12094) |
help on directory helper - El Forum - 10-06-2008 [eluser]syntaxerror[/eluser] hi, i need help. its my first time in using codeigniter. i need a script that reads files in a folder into an array. i think the directory helper can do it. but i dont know how to use it. in my controller i made a function Code: function index() Code: <?php foreach($map as $file): ?> but there is an error Code: A PHP Error was encountered Code: A PHP Error was encountered please help thanks help on directory helper - El Forum - 10-06-2008 [eluser]xwero[/eluser] You haven't added map to the data array. help on directory helper - El Forum - 10-06-2008 [eluser]syntaxerror[/eluser] ok Code: $data['map']= directory_map('C:/xampp/htdocs/AccmaRoster/', TRUE); Code: $data['map']= directory_map('C:/xampp/htdocs/$_POST['directory']/', TRUE); thanks help on directory helper - El Forum - 10-06-2008 [eluser]Yash[/eluser] Code: $data['map'] = directory_map('C:/xampp/htdocs/AccmaRoster/', TRUE); //change this line help on directory helper - El Forum - 10-06-2008 [eluser]syntaxerror[/eluser] Code: $data['map'] = directory_map('C:/xampp/htdocs/AccmaRoster/', TRUE); //change this line help on directory helper - El Forum - 10-06-2008 [eluser]Yash[/eluser] use base_url() function and don't use hard coding help on directory helper - El Forum - 10-06-2008 [eluser]syntaxerror[/eluser] the user has to enter the directory where he wants to view the list of files Code: $data['map'] = directory_map('C:/xampp/htdocs/AccmaRoster/'(the directory must be user entry), TRUE); thanks help on directory helper - El Forum - 10-06-2008 [eluser]xwero[/eluser] adding the post value without validation isn't a good idea. But when you validated the input you can add the $_POST value to the function. |