Welcome Guest, Not a member yet? Register   Sign In
(SOLVED)Calling a const field of a Model from Controller?
#1

[eluser]juanvillegas[/eluser]
I don't know if this would be the ideal CI way, but im making some tests here!
Let's say you've got model

Code:
class Test_model extends Model {

const MYVALUE='somevalue';


<...>
}

and CONTROLLER
Code:
class Register extends Controller {

function __construct() {
$this->load->model('Test_model','test');
}
<...>
}

How would i normally access const MYVALUE from the controller? I have tried a few but couldnt get it working.
Thanks!
#2

[eluser]danmontgomery[/eluser]
Code:
Test_model::MYVALUE

http://www.php.net/manual/en/language.oo...stants.php
#3

[eluser]juanvillegas[/eluser]
Exactly, thanks a lot!




Theme © iAndrew 2016 - Forum software by © MyBB