kenjis / codeigniter-ss-twig

A Simple and Secure Twig integration for CodeIgniter 3.x and 4.x
MIT License
168 stars 46 forks source link

Trying to use ckeditor and ckFinder with twig and CI #46

Closed Charlyzon87 closed 3 years ago

Charlyzon87 commented 6 years ago

Ok I'm a retard.

Add the folders and give the class to the textarea.

I'm trying to use ckEditor, ckFinder and twig & CI.

For this I'm trying to create a function that calls the editor method on the library ckEditor, but I can't make it work. I'm doing the following:

twig_helper.php

function editor($name, $id, $value = "", $config = array(), $events = array()){
     echo $this->ckeditor->editor($name, $id, $value = "", $config = array(), $events = array()); 
}

controller.php

$this->load->helper('twig');
$config = [
  functions' => ['editor']
];
$this->load->library('twig', $config);
$this->data['content'] = $this->twig->render('view.php', array('imgurl' => $this->data['imgurl']));
$this->twig->display('index.php', $this->data); 

view.php {% editor("textarea name","default textarea value") %}

Receiving the following error: Type: Twig_Error_Syntax Message: Unknown "editor" tag.

I don't know if it exists a simpler way to do this, or if i'm making some mistakes on my code. I'll accept any advice.

I'm using ckEditor and ckFinder without twig, following the tutorial below, without problems. http://www.webpreparations.com/how-to-integrate-ckeditor-in-codeigniter-using-bootstrap/

But obviously i can't call the php method <?php echo $this->ckeditor->editor("textarea name","default textarea value"); ?> on the twig view.

Regards and thank you for your help.

kenjis commented 6 years ago

It seems the function editor can't access $this->ckeditor.

kenjis commented 3 years ago

If you have still the problem, feel free to reopen.