Pregunta

I've found this script for converting wiki syntax to HTML in php and i've tried to integrate it into Codeigniter. it seems really easy to use. However, it's not working, and instead producing around 8 of these errors:

Message: Use of undefined constant LS_NONE - assumed 'LS_NONE' 

I think this is because Codeigniter helpers are not a class but rather functions, and this bit of code is a class, or does this issue lie with something else? I've also tried to use it as a model without success.

It also seems horribly outdated (2007). Could somebody suggest a really simple alternative or maybe give an idea of how to convert this to a simple function if that is possible? It's a very short piece of code. I'm not sure how these constants work in relationship to a function versus a class.

I've given the Text_Wiki from Pear ago, but the use and complexity well exceeds both my requirements and knowledge :)

//Any help would be greatly appreciated

Loaded using:

    $row = $query->row();
    $content=$row->course_content;
    $this->load->helper('wiki');
    $content=explode("\n", $content);               
    $output = WikiTextToHTML::convertWikiTextToHTML($content);
    $html=array_merge($output);
    $data['contents'][]= $html;
    $this->load->view('default/a',$data);
¿Fue útil?

Solución

It looks like the script is actually a class. put it in the libraries folder and load it with $this->load->library(). That will allow it to properly initialize and define the constants that it uses.

something like:

$this->load->library('wikitexttohtml');
$this->wikitexttohtml->convertWikiTextToHTML($wiki_text);
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top