Answer the question
In order to leave comments, you need to log in
How to make the widget action work?
Good afternoon! Faced a strange problem - the action does not want to work on the widget. I'm trying to make a popup form according to the manual. 'action' => array('/store/quick')
this is how I call it.
and quick.php respectively in the store folder... but when clicked, a blank page opens.
action code (taken from the manual, did not change anything)
public function actionQuick() {
$model=new QuickForm;
$model->attributes=$_POST['QuickForm'];
if($model->validate()) {
$headers="From: [email protected]\r\nReply-To: [email protected]";
$body = "\n\nОтправитель: ".$model->name."\t Телефон: ".$model->phone."\t Время звонка: ".$model->timeToCall;
mail('[email protected]','ПЕРЕЗВОН!',$body,$headers);
$this->redirect(array('site/index'));
}
$this->redirect(array('site/index'));
}
public function actions() {
return array(
'my' => 'frontend.controllers.quick2',
);
}
class quick2 extends CAction
{
public function run()
{
$model=new QuickForm();
if(isset($_POST['QuickForm']))
{
$model->attributes=$_POST['QuickForm'];
if($model->validate()) {
$headers="From: $model->email\r\nReply-To: $model->email";
$body = "\n\nОтправитель: ".$model->name."\t Телефон: ".$model->phone."\t Email: ".$model->email."\t Задача: ".$model->message;
// mail(Yii::app()->params['adminEmail'],'Письмо с сайта loco.ru от '.$model->name, $body, $headers, '-f [email protected]');
mail('[email protected]','Письмо с сайта loco.ru от '.$model->name, $body, $headers, '-f [email protected]');
Dialog::message('flash-success', 'Отправлено!', 'Спасибо, '.$model->name.'! Ваше письмо отправлено!');
$this->redirect(array('site/index'));
}
}
$this->redirect(array('site/index'));
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question