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 删除虚拟显示器驱动 删除所有 Xorg 配置文件 删除显示器缓存文件 重启系统 可是依旧无法退出虚拟显示器
  • ¥15 vscode程序一直报同样的错,如何解决?
  • ¥15 关于使用unity中遇到的问题
  • ¥15 开放世界如何写线性关卡的用例(类似原神)
  • ¥15 关于并联谐振电磁感应加热
  • ¥60 请查询全国几个煤炭大省近十年的煤炭铁路及公路的货物周转量
  • ¥15 请帮我看看我这道c语言题到底漏了哪种情况吧!
  • ¥66 如何制作支付宝扫码跳转到发红包界面
  • ¥15 pnpm 下载element-plus
  • ¥15 解决编写PyDracula时遇到的问题