Welcome Guest, Not a member yet? Register   Sign In
Lang file, retrieve a Costant
#1

[eluser]daweb[/eluser]
Hi guys,

excuse me bad english first of all.

Usually I set my Costants in costants.php and I use most of them in my *_lang.php file, this way:

Code:
$config[MY_COSTANT] = "My Message";

I would like to use some Costants in one of my library, this way:

Quote:const MY_LIB_OR_MODEL_COSTANT = "My Lib or Model Message";

Is there a way to use this costant in my languages file... (eg. self::MY_LIB_OR_MODEL_COSTANT) -> I know: self:: cant't works is just an example...
#2

[eluser]daweb[/eluser]
Nobody?
#3

[eluser]danmontgomery[/eluser]
The library has to be loaded, once it is you can access class constants with Classname::CONSTANT;

eg:

Code:
class Some_class
{
    const EXAMPLE = 'some value';
}

// ...

echo Some_class::EXAMPLE;
#4

[eluser]daweb[/eluser]
Thank your reply.

It doens't works from a language file...

Not for me..

Any ideas?
#5

[eluser]daweb[/eluser]
Try to better explain.

The class is loaded in autoload config file.

But I don't know how to access to CONST from the *_lang.php file.

My class name is:

Clients_lib

In the lang file:

$lang[Clients_lib::MY_COSTANT] doens't works. Is there any solutions?




Theme © iAndrew 2016 - Forum software by © MyBB