Following is the app architecture:

application
  |-config
    |-config.inc.php  (contains definition of App ROOT)
library
  |-autoload.class.php
public
  |-css
  |-img
index.php

Problem: I am not understanding how to call config file so as to set and access App Root.

In Config File - I have defined Constant -> MY_APP_ROOT

Now, I wish to access all Application Folders with the help of MY_APP_ROOT.

Could you please help?
Thank you friends.

Member Avatar for iamthwee

I'm assuming there is nothing fancy going on here. Frameworks like CI, laravel probably just access the config file as you would normally, so you would pass in the path to the directory relative or absolute... take your pick.

Include or required the config file where ever you need it. require($_SERVER['DOCUMENT_ROOT'] . '/application/config/config.inc.php');

Member Avatar for diafol

So accessing application folders thereafter...
If using Gabriel's require...
e.g.

$library = MY_APP_ROOT. '/library/'; 

Is that what you're looking for?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.