dongmeiran609914 2013-09-30 03:38
浏览 30
已采纳

在yii中加载新页面

I'm trying link the form I created in yii, and make it to go to another page. However since I'm new to yii, I'm confused if it's calling the controller, model or view, plus I dont have a clue where the rendering of the new page should be placed.

I've just taken over someone's work and I'm still studying the yii framework itself.

The code for the form is:

<?php $form=$this->beginWidget('CActiveForm', array('id'=>'apply-form','action' => 
'/site/apply','enableAjaxValidation'=>false,'htmlOptions' => array('enctype' => 'multipart/form-data'),)); ?>

and for the site controller its

public function actionApply()
{
$model = new ApplyForm;
if(isset($_POST['ApplyForm']))
{
$model->attributes=$_POST['ApplyForm'];
$stringsubject ="Application for Crunch Marketing-".$_POST['ApplyForm']['fieldName'];           
$model->subject = $stringsubject;
if($model->validate())
{
$mailer = new EmailSender();
$success = $mailer->send($model, 'test@crunch.com.ph');
}
}
$this->render('index',array(
'contactModel' => new ContactForm,
'applyModel' => $model,
));
}

I dont know how the flow actually works. I'm used to the standard form action call, so I'm really confused.

  • 写回答

2条回答 默认 最新

  • douzhangwei5265 2013-10-02 13:54
    关注

    The answer is very broad. To have idea about fundamental things in yii this is good article I came by through:

    http://www.larryullman.com/2009/10/31/getting-started-with-the-yii-framework/

    Read the whole series. May it helps to clear the flow.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 C# datagridview 栏位进度
  • ¥15 vue3页面el-table页面数据过多
  • ¥100 vue3中融入gRPC-web
  • ¥15 kali环境运行volatility分析android内存文件,缺profile
  • ¥15 写uniapp时遇到的问题
  • ¥15 vs 2008 安装遇到问题
  • ¥15 matlab有限元法求解梁带有若干弹簧质量系统的固有频率
  • ¥15 找一个网络防御专家,外包的
  • ¥100 能不能让两张不同的图片md5值一样,(有尝)
  • ¥15 informer代码训练自己的数据集,改参数怎么改