سلام
در این کد مقدار با پست ارسال میشه ولی
مقدار نمی گیره چرا ؟
اکشن فرم
در این کد مقدار با پست ارسال میشه ولی
کد:
$model->attributes
public function actionCreate() { $this->pageTitle = ' ایجاد مطلب' ; $model=new Content; // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if(isset($_POST['Content'])) { $model->attributes=$_POST['Content']; if($model->save()) $this->redirect(array('view','id'=>$model->id)); } $this->render('create',array( 'model'=>$model, )); }
اکشن فرم
<div class="form"> <?php $form=$this->beginWidget('CActiveForm', array( 'id'=>'content-form', // Please note: When you enable ajax validation, make sure the corresponding // controller action is handling ajax validation correctly. // There is a call to performAjaxValidation() commented in generated controller code. // See class documentation of CActiveForm for details on this. 'enableAjaxValidation'=>false, )); ?> <div class="panel panel-primary"> <div class="panel-heading "> <?php $header = ($model->isNewRecord)? 'ایجاد مطلب' : 'ویرایش مطلب'; echo $header ; ?> </div> <div class="panel-body"> <?php echo CHtml::submitButton('ذخیره و بستن',array('class'=>'btn btn-success button')).' '; echo CHtml::link('انصراف',array('content/admin'), array('class'=>'btn btn-danger ','name'=>'cancel')); ?> </div> </div> <ul class="nav nav-tabs"> <li class="active"><a data-toggle="tab" href="#home">مطلب</a></li> <li><a data-toggle="tab" href="#publish">گزینه های انتشار</a></li> <li><a data-toggle="tab" href="#meta">گرینه های متا</a></li> </ul> <?php echo $form->errorSummary($model, null, null, array('class'=>'alert alert-danger')); ?> <div class="tab-content"> <div id="home" class="tab-pane fade in active"> <br/> <div class="col-md-12"> <div class="col-md-6 form-inline"> <?php echo $form->labelEx($model,'title'); ?> <?php echo $form->textField($model,'title',array('class'=>'form-control input-xs bg-color','size'=>50,'maxlength'=>50)); ?> </div> <div class="col-md-6 form-inline"> <?php echo $form->labelEx($model,'alias'); ?> <?php echo $form->textField($model,'alias',array('class'=>'form-control input-xs bg-color','size'=>50,'maxlength'=>50)); ?> </div> </div> <div class="col-md-12"> <br/> <div class="col-md-8"> <?php echo $form->labelEx($model,'fulltext'); ?> <?php $this->widget('application.extensions.tinymce.SladekTinyMce'); echo $form->textArea($model,'fulltext',array('id'=>'fulltext','rows'=>6, 'cols'=>50)); ?> <script type="text/javascript"> tinymce.init({ selector: "textarea#fulltext", theme: "modern", height : 200 , plugins: [ "advlist autolink link image lists charmap print preview hr anchor pagebreak spellchecker", "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking", "save table contextmenu directionality emoticons template paste textcolor" ], content_css: "css/content.css", toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | print preview media fullpage | forecolor backcolor emoticons", style_formats: [ {title: 'Bold text', inline: 'b'}, {title: 'Red text', inline: 'span', styles: {color: '#ff0000'}}, {title: 'Red header', block: 'h1', styles: {color: '#ff0000'}}, {title: 'Example 1', inline: 'span', classes: 'example1'}, {title: 'Example 2', inline: 'span', classes: 'example2'}, {title: 'Table styles'}, {title: 'Table row 1', selector: 'tr', classes: 'tablerow1'} ] }); </script> </div> <div class="col-md-4"> <div class="col-md-12"> <?php echo $form->labelEx($model,'category_id',array('style'=>'margin-left:5px;')); ?> <?php echo $form->dropDownList($model,'category_id',array(1=>'aed'),array('value'=>$model->category_id,'class'=>'selectpicker','style'=>'width:200px;')); ?> </div> <div class="col-md-12"> <?php echo $form->labelEx($model,'featured',array('style'=>'padding-top:10px;margin-left:25px;')); ?> <?php echo $form->dropDownList($model,'featured',array(0=>'خیر', 1=>'بلی'),array('value'=>$model->featured,'class'=>'selectpicker','data-style'=>'btn-success','style'=>'width:200px;')); ?> </div> <div class="col-md-12"> <?php echo $form->labelEx($model,'confirmed',array('style'=>'padding-top:10px;margin-left:21px;')); ?> <?php echo $form->dropDownList($model,'confirmed',array(0=>'خیر', 1=>'بلی'),array('value'=>$model->confirmed,'class'=>'selectpicker','style'=>'width:200px;')); ?> </div> <div class="col-md-12 form-inline"> <?php echo $form->labelEx($model,'like',array('style'=>'padding-top:10px;margin-left:19px;')); ?> <?php echo $form->textField($model,'like',array('class'=>'form-control input-xs','disabled'=>'disabled','size'=>30,'style'=>'text-align:center;')); ?> </div> <div class="col-md-12 form-inline"> <?php echo $form->labelEx($model,'dislike',array('style'=>'padding-top:10px;margin-left:6px;')); ?> <?php echo $form->textField($model,'dislike',array('class'=>'form-control input-xs','disabled'=>'disabled','size'=>30,'style'=>'text-align:center;')); ?> </div> </div> </div> </div> <div id="publish" class="tab-pane fade"> <br/> <div class="col-md-12 form-inline"> <table class="published"> <tr> <td><?php echo $form->labelEx($model,'create_time'); ?></td> <td><?php echo $form->textField($model,'create_time',array('value'=>JDF::jdate("Y /m /d - H:i",$model->create_time),'class'=>'form-control bg-color input-xs', 'disabled'=>'disabled','size'=>20)); ?></td> <td><?php echo $form->labelEx($model,'create_user'); ?></td> <td><?php empty($model->create_user)? $model->create_user=1:$model->create_user ; echo $form->textField($model,'create_user',array('value'=>$model->create->name,'class'=>'form-control bg-color input-xs', 'disabled'=>'disabled','size'=>20)); ?> </td> </tr> <tr> <td><?php echo $form->labelEx($model,'modified_time'); ?> </td> <td><?php echo $form->textField($model,'modified_time',array('value'=>JDF::jdate("Y /m /d - H:i",$model->modified_time),'class'=>'form-control bg-color input-xs', 'disabled'=>'disabled','size'=>20)); ?></td> <td><?php echo $form->labelEx($model,'modified_user'); ?> <?php empty($model->modified_user)? $model->modified_user=1:$model->modified_user ; ?> </td> <td><?php echo $form->textField($model,'modified_user',array('value'=>$model->modified->name,'class'=>'form-control bg-color input-xs', 'disabled'=>'disabled','size'=>20)); ?></td> </tr> <tr> <td><?php echo $form->labelEx($model,'publish_up'); ?></td> <td><?php $this->widget('ext.jalaliCalendar.jalaliCalendar', array( 'model'=>$model, 'attribute'=>'publish_up', 'options'=>array( 'button'=>'date_btn', 'ifFormat'=> '%Y,%m,%d ', 'dateType'=>'jalali' ), 'htmlOptions'=>array( 'class'=>'form-control bg-color input-xs', 'style'=>' text-align: right;', ), )); ?> </td> <td><?php echo $form->labelEx($model,'publish_down'); ?></td> <td> <?php $this->widget('ext.jalaliCalendar.jalaliCalendar', array( 'model'=>$model, 'attribute'=>'publish_down', 'options'=>array( 'button'=>'date_btn', 'ifFormat'=> '%Y,%m,%d ', 'dateType'=>'jalali' ), 'htmlOptions'=>array( 'class'=>'form-control bg-color input-xs', 'style'=>'text-align: right;', ), )); ?> </td> </tr> <tr> <td><?php echo $form->labelEx($model,'reference'); ?></td> <td><?php echo $form->textField($model,'reference',array('class'=>'form-control input-xs bg-color','size'=>20,'maxlength'=>50)); ?></td> <td><?php echo $form->labelEx($model,'urls'); ?></td> <td><?php echo $form->textField($model,'urls',array('class'=>'form-control input-xs bg-color','maxlength'=>250)); ?></td> </tr> </table> </div> </div> <div id="meta" class="tab-pane fade"> <br/> <div class="col-md-12"> <div class="col-md-6 form-inline"> <?php echo $form->labelEx($model,'metadesc'); ?> <?php echo $form->textArea($model,'metadesc',array('class'=>'bg-color','rows'=>4,'cols'=>50,'size'=>60,'maxlength'=>1024)); ?> </div> <div class="col-md-6 form-inline"> <?php echo $form->labelEx($model,'metakey'); ?> <?php echo $form->textArea($model,'metakey',array('class'=>'bg-color','rows'=>4,'cols'=>50,'size'=>60,'maxlength'=>2048)); ?> </div> </div> </div> </div> <?php $this->endWidget(); ?> </div><!-- form -->