Thanks very much for your reply.
Thanks to you i at least could show the "old" dataset when calling for an update.
The only problem i got now is, that i can create any "entry" anymore. I always get the error
"Fatal error: Call to a member function isAttributeRequired() on a non-object in C:\xampp\htdocs\Yii\framework\web\helpers\CHtml.php on line 1166"
There must be something wrong with the _form.php file, but Im still too noob in yii to figure out what’s wrong.
My view file looks as follows (using the tinymce widget for 1 field):
<div class="form">
<?php
$form = $this->beginWidget('CActiveForm', array(
'id' => 'entry-form',
'enableAjaxValidation' => true,
));
?>
<p class="note">Fields with <span class="required">*</span> are required.</p>
<?php /* echo CHtml::errorSummary(array($model, $translation)); */ ?>
<div class="row">
<?php echo $form->labelEx($model->translations[0], 'title'); ?>
<?php echo $form->textArea($model->translations[0], 'title', array('rows' => 1, 'cols' => 50)); ?>
<?php echo $form->error($model->translations[0], 'title'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model->translations[0], 'content'); ?>
<?php
$this->widget('application.extensions.tinymce.ETinyMce',
array('name' => 'Translation[content]',
'value' => 'Translation[content]',
'options' => array(
'theme' => 'advanced',
'skin' => 'o2k7',
/* fruther options... */
),
'htmlOptions' => array(
'rows' => 30,
'cols' => 30,
'style' => 'width:600px;height:300px;',
),
'value' => $model->translations[0]->content,
)); ?>
<?php echo $form->error($model->translations[0], 'content'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model, 'tags'); ?>
<?php echo $form->textArea($model, 'tags', array('rows' => 1, 'cols' => 50)); ?>
<?php echo $form->error($model, 'tags'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model->translations[0], 'language_code'); ?>
<?php echo $form->dropDownList($model->translations[0], 'language_code', Lookup::items('language')); ?>
<?php echo $form->error($model->translations[0], 'language_code'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model, 'type'); ?>
<?php echo $form->dropDownList($model, 'type', Lookup::items('type')); ?>
<?php echo $form->error($model, 'type'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model, 'status'); ?>
<?php echo $form->dropDownList($model, 'status', Lookup::items('PostStatus')); ?>
<?php echo $form->error($model, 'status'); ?>
</div>
<div class="row buttons">
<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
</div>
<?php $this->endWidget(); ?>
</div><!-- form -->
The update.php:
<?php
$this->breadcrumbs=array(
'Entries'=>array('index'),
$model->entry_id=>array('view','id'=>$model->entry_id),
'Update',
);
$this->menu=array(
array('label'=>'List Entry', 'url'=>array('index')),
array('label'=>'Create Entry', 'url'=>array('create')),
array('label'=>'View Entry', 'url'=>array('view', 'id'=>$model->entry_id)),
array('label'=>'Manage Entry', 'url'=>array('admin')),
);
?>
<h1>Update Entry <?php echo $model->entry_id; ?></h1>
<?php echo $this->renderPartial('_form', array('model'=>$model, 'translation' => $model->translations[0])); ?>
And the create.php:
<?php
$this->breadcrumbs=array(
'Entries'=>array('index'),
'Create',
);
$this->menu=array(
array('label'=>'List Entry', 'url'=>array('index')),
array('label'=>'Manage Entry', 'url'=>array('admin')),
);
?>
<h1>Create Entry</h1>
<?php echo $this->renderPartial('_form', array('model'=>$model, 'translation' => $model->translations[0])); ?>
Ahh one more thing i got to say: the translations[0] is just for the moment to make it run
… the loop over more than 1 translation I will make later on, so dont wonder about that ;-).
EDIT: any advice for "better" code is always welcome! - still learning to handle the yii framework ;-).
EDIT2: the problem should be something with these parts of code … "[color="#FF0000"]$model->translations[0][/color]" … thats what i could figure out so far …