Welcome Guest, Not a member yet? Register   Sign In
Calling different functions from one Controller
#1

[eluser]dtechplus[/eluser]
Hi all, I'm new to CI and RAD frameworks so if this sounds like a silly question pardon me. I want to have some (private) functions perform some action and then return some variables, then be able to call the function from another function in the same controller with the returned variable.

Maybe a little illustrative code will make this clearer;
This is what I want to do


Code:
class Code extends Controller
{

    function Code()
  {
        parent::Controller();
        $this->load->model('codemodel');
        
  }
  

  function _get($x)
  {
   $x = round($x / 86400);
   return $x; //this private function returns a value $x
              //which is used by function usex below
  }

  function usex($x)//this is an accessible/public function
  {
   get($x);
    echo $x;
  }
  {

Hope code above shows what I want to do
Is this possible in CI?
And BTW what's the best server config for developing standalone apps in CI (like bambooinvoice) ?
#2

[eluser]Crafter[/eluser]
Code:
$result = $this->get($x);
echo $result;




Theme © iAndrew 2016 - Forum software by © MyBB