Skip to content

Commit bdb6d59

Browse files
committed
Adding new path constant for main folder. Handy now that people might be creating custom directories for namespaced code.
1 parent d8caea2 commit bdb6d59

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

public/index.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@
134134
// Path to the front controller (this file)
135135
define('FCPATH', __DIR__.DIRECTORY_SEPARATOR);
136136

137+
// Path to code root folder (just up from public)
138+
define('ROOTPATH', str_replace('public'.DIRECTORY_SEPARATOR, '', FCPATH));
139+
137140
// Path to the writable directory.
138141
define('WRITEPATH', realpath($writable_directory).DIRECTORY_SEPARATOR);
139142

user_guide_src/source/general/common_functions.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,10 @@ The following constants are always available anywhere within your application.
251251
Core Constants
252252
==============
253253

254+
.. php:const:: ROOTPATH
255+
256+
The path to the main application directory. Just above ``public``.
257+
254258
.. php:const:: APPPATH
255259
256260
The path to the **application** directory.

0 commit comments

Comments
 (0)