I have an Use of undefined constant error on my project. Here is the setup
The constant is;
define('VIEW_ROOT_ADMIN', '/views/admin');
and the file called from is
<?php
$mode = file_get_contents('../app/mode.php');
require '../app/' . $mode . '.php';
require VIEW_ROOT_ADMIN . '/index.php';
This is where the error occurs;
Notice: Use of undefined constant VIEW_ROOT_ADMIN - assumed 'VIEW_ROOT_ADMIN'
The strange part of this is that it works fine on this file structure below
define('VIEW_ROOT', '/views');
<?php
$mode = file_get_contents('app/mode.php');
require 'app/' . $mode . '.php';
require VIEW_ROOT . '/index.php';
Any help here would be good :-)
This is the file structure
ROOT----
|--admin
|--index.php
|--app
|--development.php //Here are the contants define('VIEW_ROOT', '/views'); and define('VIEW_ROOT_ADMIN', '/views/admin');
|--mode.php
|--production.php
|--views
|--admin
|--index.php
|--index.php
index.php