Yii Framework Forum: CKEditor + Responsive Filemanager on YII2 - Yii Framework Forum

Jump to content

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

CKEditor + Responsive Filemanager on YII2 Rate Topic: -----

#1 User is offline   jmestral 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 24-January 18

Posted 24 January 2018 - 08:38 AM

Hello!

I'm starting to develop in Yii2 and I'm trying to use CKEditor with Responsive Filemanager.

If I only use CKEditor, it works fine:

<?= 

use dosamigos\ckeditor\CKEditor;

$form->field($model, 'tiposnoticia_descripcion')->widget(CKEditor::className(), ['preset' => 'basic']); 
	
?>


But I can't get CKEditor and Responsive Filemanager to work togheter.

CKEditor was installed with composer.

Does anyone know how to do it?

Thanks a lot! ;)
0

#2 User is offline   Owais Ali 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 12-December 17
  • Location:Karachi

Posted 25 January 2018 - 12:25 AM

View Postjmestral, on 24 January 2018 - 08:38 AM, said:

Hello!

I'm starting to develop in Yii2 and I'm trying to use CKEditor with Responsive Filemanager.

If I only use CKEditor, it works fine:

<?= 

use dosamigos\ckeditor\CKEditor;

$form->field($model, 'tiposnoticia_descripcion')->widget(CKEditor::className(), ['preset' => 'basic']); 
	
?>


But I can't get CKEditor and Responsive Filemanager to work togheter.

CKEditor was installed with composer.

Does anyone know how to do it?

Thanks a lot! ;)


There is a typo in the code you mentioned. You should use php long tag in the beginning i.e. '<?php' which ends with '?>'.
Or you can use php echo tag '<?=' only with the statement when you want to display it. In your case, you can use it before form-fields but you cannot use it before use statements.
0

#3 User is offline   jmestral 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 24-January 18

Posted 25 January 2018 - 05:52 AM

Thanks

Actually, I have this:

<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use dosamigos\ckeditor\CKEditor;

?>

<div class="tiposnoticias-form">

    <?php $form = ActiveForm::begin(); ?>

<?= 
    $form->field($model, 'tiposnoticia_descripcion')->widget(CKEditor::className(), 
    ['preset' => 'basic']); 
?>
	
	

0

#4 User is offline   jmestral 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 24-January 18

Posted 29 January 2018 - 03:45 AM

I found a package of CKEditor that includes Responsive Filemanager plugin here:

https://www.opencart...ember=tmtung144

Calling both plugins .js and replacing a textarea by CKEditor it was easy:

<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use dosamigos\ckeditor\CKEditor;

$this->registerJsFile(
    '@web/assets/js/filemanager/javascript/ckeditor/ckeditor.js',
    ['depends' => [\yii\web\JqueryAsset::className()]]
);

$this->registerJsFile(
    '@web/assets/js/filemanager/javascript/filemanager.js',
    ['depends' => [\yii\web\JqueryAsset::className()]]
);

/* @var $this yii\web\View */
/* @var $model backend\models\Tiposnoticias */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="tiposnoticias-form">

    <?php $form = ActiveForm::begin(); ?>
 
    <?= $form->field($model, 'tiposnoticia_descripcion')->textarea(['rows' => 6]); ?>

<?php
      $this->registerJsFile(
        '@web/assets/js/filemanager/javascript/replacer.js',
        ['depends' => [\yii\web\JqueryAsset::className()]]
    );
    ?>

    <div class="form-group">
        <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>



Here, I replace the textarea "tiposnoticia_descripcion" using replacer.js:

 CKEDITOR.replace( 'tiposnoticias-tiposnoticia_descripcion' ,{
    filebrowserBrowseUrl : '/advanced/backend/web/assets/js/filemanager/javascript/filemanager/dialog.php?type=2&editor=ckeditor&fldr=',
    filebrowserUploadUrl : '/advanced/backend/mestral/advanced/backend/web/assets/js/filemanager/javascript/filemanager/dialog.php?type=2&editor=ckeditor&fldr=',
    filebrowserImageBrowseUrl : '/advanced/backend/web/assets/js/filemanager/javascript/filemanager/dialog.php?type=1&editor=ckeditor&fldr='
});


I hope this can help you :P
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