Welcome Guest, Not a member yet? Register   Sign In
Object inside function - Error: "Using $this when not in object context in..."
#2

[eluser]gtech[/eluser]
have you tried this.. just cut and paste this example into a controller with the filename home.php in the controllers directory.

Code:
<?php
class Home extends Controller   {
  function Home(){
    parent::Controller();
  }

  function checkv($a) {
    switch($a) {
      case "add":
      $email = '[email protected]';
      $to = '[email protected]';
      $this->funcName($email, $to);
      break;
    }
  }

  function funcName($email, $to) {
    //line below not needed if autoloaded
    $this->load->library('email');

    $this->email->from($email);
    $this->email->to($to);
    print_r($this->email);
  }
}
?>

url: http://localhost/CI1.6.1/index.php/home/checkv/add


Messages In This Thread
Object inside function - Error: "Using $this when not in object context in..." - by El Forum - 05-07-2008, 03:06 PM



Theme © iAndrew 2016 - Forum software by © MyBB