I have a module which I want to show a view of it as a homepage. I also want to show a view of another model in the homepage. For example I want to show top ten news in the first page and show the subscribe form in the first page too. I used the renderPartial function and success to display both of them, but the subscribe form create nothing in the database. Any body can help me?
Hi thanks for fast answer. This is my module action
public function actionToday()
{
$this->layout='//layouts/main';
$model = new Hadith();
$dataProvider= $this->loadModel($model->todayHadith());
$this->render('today',array(
'dataProvider'=>$dataProvider,
));
}
which is a custom action returns a Hadith that its date is set to today date. This is the view code for that action.
In the first line I create an instance of User which is a model(non-module) and then renderPartial the create view of that. This is the create action of the User model
public function actionCreate()
{
$model=new User;
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['User']))
{
$model->attributes=$_POST['User'];
if($model->save())
$this->redirect(array('view','id'=>$model->id));
}
$this->render('create',array(
'model'=>$model,
));
}