Access scriptcase development app folder root

I am using the existing menu function and a group based permission system. For creating the group_apps table it would be helpful to be able to access the project folder root and its subfolders.

Does anybody know how to do it.
Help would be very welcome

Hello Sawjer,

I have a function that I created in an External Library that may help. Take a look at it and see if it can give you what you need. This function uses the $_SERVER PHP variable to pull some of the data from the INI file.

		public function fncRetrievePathorFileProperties($sOption)
			{
				//****************************************************************************************************
				//*                                                                                                  *
				//*       Function: fncRetrievePathorFileProperties                            Version #: 01.00.000  *
				//*                                                                                                  *
				//*        Created: 11/16/2018                                                                       *
				//*       Modified: 09/26/2020                                                                       *
				//*                                                                                                  *
				//*    Description: This function returns the Path or File property requested by the optional text   *
				//*				    provided.                                                                        *
				//*                                                                                                  *
				//****************************************************************************************************
				//  01.00.000  11/16/2018   07/06/2019    Initial release of this Function
				//  01.01.000  12/04/2019   02/02/2020    Updated Class to Support UACB_Framework v03.00.000
				// 09/27/2020
			
				// Function Parameter Variables
				//	$sOption							Perameter to return the selected Path or File
				//  	AppFolder						Application Folder
				// Function General Variables
				//   sProjectDocRoot					Root of the Web Server
				//   sPathScript						Path to the Execution Script
				//   oFolder							Folder Array
				//   iLevels							Folders without First and Last Entries
				//   bCommand							Successful Command: True/False
				//   sResult							Result Value
				// Function returns Nothing

				//****************************************************************************************************
				//*  INITIALIZE VARIABLES                                                                            *
				//****************************************************************************************************
				$sProjectDocRoot	= $_SERVER['DOCUMENT_ROOT'];		// Root of the Web Server
				$sPathScript		= $_SERVER["SCRIPT_NAME"];			// Path to the Execution Script
				$oFolder			= explode('/', $sPathScript);		// Folder array
				$iLevels			= count($oFolder) - 2;				// Folders without First and Last Entries
				$bCommand			= false;							// Successful Command: True/False
				$sResult			= "";								// Result Value
			
				//****************************************************************************************************
				//*  RETRIEVE REQUESTED SETTING                                                                      *
				//****************************************************************************************************
				switch ($sOption)
					{
						case "ProjectDocRoot":
							$sResult = $sProjectDocRoot;
							$bCommand = true;
							break;
						case "ProjectScript":
							$sResult = "";
							for ($i = 1; $i < $iLevels; $i++)
								{
									$sResult = $sResult . $oFolder[$i];
									$sResult = $sResult . chr(47);
								}
							$sResult = $sResult . $oFolder[$i];
							$bCommand = true;
							break;
						case "ProjectPathLib":
							$sResult = $sProjectDocRoot;
							for ($i = 1; $i < $iLevels - 1; $i++)
								{
									$sResult = $sResult . $oFolder[$i];
									$sResult = $sResult . chr(47);
								}
							$sResult = $sResult . $oFolder[$i];
							$sResult = $sResult . chr(47) . "_lib";
							$sResult = $sResult . chr(47) . "libraries";
							$sResult = $sResult . chr(47) . "grp";
							$bCommand = true;
							break;
						case "AppFolder":
							$sResult = $oFolder[$iLevels];
							$bCommand = true;
							break;
						case "AppFile":
							$sResult = $oFolder[$iLevels];
							$sResult = $sResult . ".php";
							$bCommand = true;
							break;
						case "SettingsFile":
							$sResult = $oFolder[$iLevels];
							$sResult = $sResult . ".ini";
							$bCommand = true;
							break;
					}

				//****************************************************************************************************
				//*  RETURN ARRAY TO CALLING APPLICATION OR FUNCTION                                                 *
				//****************************************************************************************************
				if ($bCommand == true)
					{
						return $sResult;
					}
				else
					{
						return false;
					}

			}

I learned quite a while back to use an External Library. I use an Autoloader to load the classes I need the contain the useful functions such as the one above. This one is a general use function to assist with requests such as yours. I hope you find it useful.

Thank you, I will try it out.
sawjer