Welcome Guest, Not a member yet? Register   Sign In
pls help
#2

[eluser]Otemu[/eluser]
Quite a few ways to do this:

If it just one controller then just put your variables at the top something like this:
Code:
class MyGlobalVariables extends CI_Controller{

$myVariable = 'hi am a global variable';

  function someCoolFunction(){
      
     echo $this->myVariable ;
  }
  function someOtherCoolFunction(){
      
     echo $this->myVariable ;
  }
}
Create your variables within My_Controller have it extend CI_Controller, then instead of using class myGlobalVariables extends CI_Controller you would have myGlobalVariables extends My_Controller.
Create a library
Simple method would be just to save your variables in the config
You could use constants \application\config\constants.php


Messages In This Thread
pls help - by El Forum - 02-19-2013, 03:01 AM
pls help - by El Forum - 02-19-2013, 03:56 AM



Theme © iAndrew 2016 - Forum software by © MyBB