blob: cf88732d332272fe038a8dc5ec80e54db18beabf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
################
Directory Helper
################
The Directory Helper file contains functions that assist in working with
directories.
.. contents:: Page Contents
Loading this Helper
===================
This helper is loaded using the following code
::
$this->load->helper('directory');
The following functions are available:
directory_map()
===============
This function reads the directory path specified in the first parameter
and builds an array representation of it and all its contained files.
.. php:method:: directory_map($source_dir[, $directory_depth = 0[, $hidden = FALSE]])
:param string $source_dir: path to the ource directory
:param integer $directory_depth: depth of directories to traverse (0 =
fully recursive, 1 = current dir, etc)
:param boolean $hidden: whether to include hidden directories
Examples::
$map = directory_map('./mydirectory/');
.. note:: Paths are almost always relative to your main index.php file.
Sub-folders contained within the directory will be mapped as well. If
you wish to control the recursion depth, you can do so using the second
parameter (integer). A depth of 1 will only map the top level directory::
$map = directory_map('./mydirectory/', 1);
By default, hidden files will not be included in the returned array. To
override this behavior, you may set a third parameter to true (boolean)::
$map = directory_map('./mydirectory/', FALSE, TRUE);
Each folder name will be an array index, while its contained files will
be numerically indexed. Here is an example of a typical array::
Array ( Â Â Â
[libraries] => Array   Â
( Â Â Â Â Â Â Â
[0] => benchmark.html       Â
[1] => config.html       Â
[database] => Array
( Â Â Â Â Â Â Â Â Â Â Â Â Â
[0] => query_builder.html             Â
[1] => binds.html             Â
[2] => configuration.html
[3] => connecting.html             Â
[4] => examples.html             Â
[5] => fields.html             Â
[6] => index.html
[7] => queries.html
) Â Â Â Â Â Â Â
[2] => email.html       Â
[3] => file_uploading.html       Â
[4] => image_lib.html       Â
[5] => input.html       Â
[6] => language.html       Â
[7] => loader.html       Â
[8] => pagination.html       Â
[9] => uri.html
)
|