Jump to content

Define Function Notice


Glese

Recommended Posts

I am trying to use absolute path across my project excluding the domain as of now and I am trying to do it as follows:

 

 

    define('root', '/php_projects/myproject/');


    // The Standard Data

    $path = "path.php";
    $connectvars = "connectvars.php";
    
    
    
    // The CSS Styles

    $reset_css = root . "view/reset.css";
    $style_css = root . "view/style.css";

 

This works so far, the only problem I am having is that it is producing a notice. And my question is, how can I get rid of the notice?

 

The notice is this one:

 

Notice: Constant root already defined in C:\xampp\htdocs\php_projects\myproject\path.php on line 3

 

Why does the notice get produced in first place? I never defined it twice, as it states. :P

Link to comment
https://forums.phpfreaks.com/topic/251954-define-function-notice/
Share on other sites

The path.php file gets included into the header.php file, and from there on I am using variables for every path on the whole project MVC style.

 

But other than the header.php I do not include it any where. You mentioned a check, is there any specific way to do it.

 

Other than that I will try to define it directly in the header.php file and see if that will work.

 

EDIT: Putting the define function inside of header.php file did solve it, keep in mind that I did not define it twice though, I assume it may have become reloaded twice.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.