machte eine einfache Einreichung Benutzerformular E-Mail & Stadt Daten in der Datenbank gespeichert, jetzt muss ich in diesem Formular nach Vorlage des Datensystems hinzufügen automatische E-Mail auf Benutzer-Adresse, aber mit der genannten Variable ich benutze Eine Variable namens $lang
Wenn Benutzereingabe ist ar so senden Sie die E-Mail in arabisch oder wenn Benutzereingabe en so senden Sie E-Mail in Englisch, gibt es zwei Probleme, die ich weiß nicht, wie diese E-Mail-Klasse in Code für Vorschläge zu beheben ich teile Code.coderigniter - E-Mail-Klasse - Registrierung nach der Einreichung
E-Mail Klasse
public function email() {
$email = $this->input->post('email');
$city = $this->input->post('city');
$this->load->library('email');
$this->email->from('[email protected]', 'Halalat');
$this->email->to('$emai');
$this->email->subject('Halalat Newsletter Subscription');
$this->email->message('Thankyou for submission');
$this->email->send();
echo $this->email->print_debugger();
}
user.php in Controller
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class User extends CI_Controller {
function __construct() {
parent::__construct();
$this->load->helper('form');
$this->load->helper('url');
$this->load->library('user_agent');
$this->load->library('form_validation');
}
public function create_user() {
// field name, error message, validation rules
$lang = $this->input->post("lang");
$this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email|is_unique[users.email]');
$this->form_validation->set_rules('city', 'City', 'trim|required');
if ($this->form_validation->run() == FALSE) {
if ($lang == "en") {
if ($this->agent->is_mobile()) {
$this->load->view('m_english_signup');
}
else
{
$this->load->view('d_english_signup');
}
} //if ($this->agent->is_mobile())
else
{
if ($this->agent->is_mobile()) {
$this->load->view('m_arabic_signup');
}
else
{
$this->load->view('d_arabic_signup');
}
}
}
else
{
$this->load->model('Users_model');
if ($query = $this->Users_model->create_member()) {
if ($lang == "en") {
if ($this->agent->is_mobile()) {
$this->load->view('m_english_thanks');
}
else
{
$this->load->view('d_english_thanks');
}
}
else
{
if ($this->agent->is_mobile()) {
$this->load->view('m_arabic_thanks');
}
else
{
$this->load->view('d_arabic_thanks');
}
}
}
}
}
}
users_model.php in Modell
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
class Users_model extends CI_Model
{
function create_member()
{
$new_member_insert_data = array(
'email' => $this->input->post('email'),
'city' => $this->input->post('city'),
);
$insert = $this->db->insert('users', $new_member_insert_data);
return $insert;
}//create_member
}
** es zwei Probleme Ich stelle mich ** Was sind die zwei Probleme? –
1- Wie E-Mail-Klasse und wo zu implementieren. 2- Wie man zwei Spracheingabe mit E-Mail-Klasse verwaltet. – FormaL
Für 1: siehe http://stackoverflow.com/q/16969572/270037 –