summaryrefslogtreecommitdiffstats
path: root/user_guide_src/source/helpers/path_helper.rst
diff options
context:
space:
mode:
authordchill42 <dchill42@gmail.com>2012-07-23 16:53:47 +0200
committerdchill42 <dchill42@gmail.com>2012-07-23 16:53:47 +0200
commitc5079de78e5141330c07e990811ef15e998e95aa (patch)
tree0f39d8c4fc7614246fc185810bfeaa7fad88a33a /user_guide_src/source/helpers/path_helper.rst
parent00fcb545109d4e61bc14e403ec828749c34a54b3 (diff)
parentede49ba66b127535f3430e20aac72ceed2c4611a (diff)
Merge branch develop of github.com:/EllisLab/CodeIgniter into session
Diffstat (limited to 'user_guide_src/source/helpers/path_helper.rst')
-rw-r--r--user_guide_src/source/helpers/path_helper.rst43
1 files changed, 43 insertions, 0 deletions
diff --git a/user_guide_src/source/helpers/path_helper.rst b/user_guide_src/source/helpers/path_helper.rst
new file mode 100644
index 000000000..847f5a08b
--- /dev/null
+++ b/user_guide_src/source/helpers/path_helper.rst
@@ -0,0 +1,43 @@
+###########
+Path Helper
+###########
+
+The Path Helper file contains functions that permits you to work with
+file paths on the server.
+
+.. contents:: Page Contents
+
+Loading this Helper
+===================
+
+This helper is loaded using the following code
+
+::
+
+ $this->load->helper('path');
+
+The following functions are available:
+
+set_realpath()
+==============
+
+Checks to see if the path exists. This function will return a server
+path without symbolic links or relative directory structures. An
+optional second argument will cause an error to be triggered if the path
+cannot be resolved.
+
+::
+
+ $file = '/etc/php5/apache2/php.ini';
+ echo set_realpath($file); // returns "/etc/php5/apache2/php.ini"
+
+ $non_existent_file = '/path/to/non-exist-file.txt';
+ echo set_realpath($non_existent_file, TRUE); // shows an error, as the path cannot be resolved
+ echo set_realpath($non_existent_file, FALSE); // returns "/path/to/non-exist-file.txt"
+
+ $directory = '/etc/php5';
+ echo set_realpath($directory); // returns "/etc/php5/"
+
+ $non_existent_directory = '/path/to/nowhere';
+ echo set_realpath($non_existent_directory, TRUE); // shows an error, as the path cannot be resolved
+ echo set_realpath($non_existent_directory, FALSE); // returns "/path/to/nowhere"