Welcome Guest, Not a member yet? Register   Sign In
How to get the filename's from a the views directory
#1

[eluser]Gwarrior[/eluser]
I want to get an array of filename's from the views directory, with the use of the file helper and the get_filenames() function. I can't seem to find a working path. Currently, I have the folder stored at C:\\wamp\www\contentcreator\system\application\views\cc_groups. My question is, how would I write this in a path so it works without modification once moved onto a server?

get_filenames('./system/application/views/cc_groups/') will not product a result at all.

Thanks in advance!
#2

[eluser]Gwarrior[/eluser]
Also, I have tried the following:

Code:
// get the fieldset data
        $path = APPPATH.'views/cc_groups/';
        $data['fieldset_data'] = get_filenames($path);

Which also produces no result. My folder is readable/writable. No idea what's happening, but it's extremely frustrating to get hung up on such a simple thing.
#3

[eluser]Gwarrior[/eluser]
SOLVED! -- Disregard.
#4

[eluser]John_Betong[/eluser]
[quote author="Gwarrior" date="1255468936"]SOLVED! -- Disregard.[/quote]
 
For the benefit of others with the same problem it would help if you supplied your solution.
 
 
 
#5

[eluser]showman[/eluser]
Yes, it's a pity grad_student didn't reply with a solution, as I have the same problem.

I have full read/write access to the my_images folder mentioned below, but still get no results even though folder contains many files.

here is the code in my model:

Code:
$my_images_path=base_url().'my_images/';
$my_images=get_filenames($my_images_path);
print_r($my_images_path);
echo "<br>my_images="; print_r($my_images);

$my_images_path returns a correct value, but $my_images returns an empty array.

any suggestion welcome.

showman
#6

[eluser]showman[/eluser]
Just realised I should be using file path and not base_url for my path to the folder !

used full path (as appears in predefined $GLOBALS) and it works fine - silly me !

showman




Theme © iAndrew 2016 - Forum software by © MyBB