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.

Recommended Answers

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

$library = MY_APP_ROOT. '/library/'; 

Is that what you're looking for?

Jump to Post

All 3 Replies

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

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 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.