Yii Framework Forum: [EXTENSION] CKEditor | Undefined variable: model - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[EXTENSION] CKEditor | Undefined variable: model Rate Topic: -----

#1 User is offline   arsitek 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 127
  • Joined: 10-October 08

Posted 24 October 2009 - 11:27 AM

How to fix error of "Undefined variable: model" in line 2;
$this->widget('application.extensions.my.ckeditor.CKEditor', array(
'model'=>$model,
'attribute'=>'text',
'language'=>'en',
'editorTemplate'=>'full',
));

0

#2 User is offline   tri 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,651
  • Joined: 20-November 08
  • Location:Stockholm, Sweden

Posted 24 October 2009 - 12:08 PM

You should pass a model when you render the view
$this->render('some_view', array('model'=>$some_model));


Edit:
Or you can add code in the view if you prefer that
$model = SomeModel::model()-find();


/Tommy
Don't forget to read The Definitive Guide to Yii (en) (sv) | The class reference has the details
0

#3 User is offline   arsitek 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 127
  • Joined: 10-October 08

Posted 24 October 2009 - 07:39 PM

Thank Tommy.. :)

Now I have a new error, "Undefined variable: language".

C:\www\webapps\protected\extensions\ckeditor\CKEditor.php(90)

00078:         $this->setLanguage(Yii::app()->language);
00079:     }
00080: 
00081:     public function setLanguage($value){
00082:         $lang = (($p = strpos($value, '_')) !== false) ? str_replace('_', '-', $value) : $value;
00083:         if (in_array($lang, $this->allowedLanguages)) {
00084:             $this->language = $lang;
00085:         }
00086:           else {
00087:              $suffix = empty($lang) ? 'en' : ($p !== false) ? strtolower(substr($lang, 0, $p)) : strtolower($lang);
00088:              if (in_array($suffix, $this->allowedLanguages)) $this->language = $suffix;
00089:           }
00090: if(isset($this->allowedLanguages[$language]))
00091:             $this->language=$language;
00092:     }
00093: 




I tried to put 'language' in view, but it still error.

How to fix this?
0

#4 User is offline   tri 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,651
  • Joined: 20-November 08
  • Location:Stockholm, Sweden

Posted 24 October 2009 - 08:42 PM

I don't know about CKEditor, had to download it now.

I would try with
if(isset($this->allowedLanguages[$lang]))
  $this->language=$lang;


/Tommy
Don't forget to read The Definitive Guide to Yii (en) (sv) | The class reference has the details
0

#5 User is offline   arsitek 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 127
  • Joined: 10-October 08

Posted 24 October 2009 - 10:05 PM

Thank again Tommy..

Now I have new problem about how CKEditor appear in view page.

I used firefox v3.5.3

Here I attached the screencapt.

Attached File  ckeditor.jpg (152.43K)
Number of downloads: 66

What I need from CKEditor is it can delete uploaded file where FCKEditor can't do it like in CKEditor demo page.

But, in extention I can't find the fitures upload and delete uploaded files.
How to anable this features?

thank a lot. :)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users