• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
(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!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.