Я новичок в codeigniter.
Я создал два контроллера, App и EmailController, моя цель - изменить массив элементов $date["subject"]
или другие элементы из App Controller.
include APPPATH.'controllers/EmailController.php';
class App extends EmailController {
function index() {
$sender = $this->input->post('sender');
$data = $this->data;
if($sender == 1)
{
$data["subject"] = "Sender One";
file_get_contents(site_url('emailcontroller/send'));
}
if($sender == 2)
{
$data["subject"] = "Sender Two";
file_get_contents(site_url('emailcontroller/send'));
} else
{
file_get_contents(site_url('emailcontroller/send'));
}
}
}
Это мой EmailController:
class EmailController extends CI_Controller {
var $data;
function __construct()
{
parent::__construct();
$this->load->helper('url');
$this->data = array(
'from_name' => 'Default Sender',
'to' => 'default@email.com',
'subject' => 'Default Subject' //use default subject if $sender is not 1 or 2
);
}
public function send() {
$data = $this->data;
...
$this->email->from($from);
$this->email->to($data['subject']);
....
}
Спасибо за продвижение!