how to define global constants in codeigniter in constants.php
You don't need to load constants anywhere, they're automatically autoloaded by CI itself, that is the point of them. To use them keep in mind they are constants and not a variable as you're used to with the $. So in your case after defining them, anywhere in your application you could for example use:
if($user->userType == SuperAdmin)
{
do something here;
}
Note that the SuperAdmin is written without a $ preceding it and not inside quotes. Again, after defining them in the constants file you need to do nothing else to begin using them in your application.
First of all use the conventions that you must define the constants in capital letters. Like
define('SUPERADMIN','1');
define('ADMIN','2');
define('CITYADMIN' '3');
you can use the constants in controller like
if($user->userType == SUPERADMIN)
{
//Your code ...
}
and if you want to use in html file/ view file in codeigniter you can use constants in html file like
<?php echo SUPERADMIN; ?>
You can access the constants in this way.