CodeIgniter Forums
Using Markdownify with CI, doesn't work? Nothing happens. - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Using Markdownify with CI, doesn't work? Nothing happens. (/showthread.php?tid=22055)



Using Markdownify with CI, doesn't work? Nothing happens. - El Forum - 08-28-2009

[eluser]ajushi[/eluser]
Hi, I downloaded Markdownify from http://milianw.de/projects/markdownify/ and extracted it to my application/libraries/ directory.

I did a:
Code:
$this->load->library('markdownify');
echo $this->markdownify->parseString('<b>Test</b>');

But the output is the same html (<b>Test</b>). It didn't work. Did I do something wrong?


Using Markdownify with CI, doesn't work? Nothing happens. - El Forum - 08-29-2009

[eluser]ajushi[/eluser]
Also do I need to instantiate Markdownify or is it instantiated using $this->load->library('markdownify'); ? I think there's seomthing not working there..


Using Markdownify with CI, doesn't work? Nothing happens. - El Forum - 04-24-2010

[eluser]GDmac - expocom[/eluser]
I downloaded PHP Markdown Extra from Michelf
(which has some extra features like inline HTML and tables)
http://michelf.com/projects/php-markdown/extra/

Renamed markdown.php to markdown_helper.php and
dropped it in the helpers directory. Load and use the helper
Code:
$this->load->helper('markdown');
$my_var = markdown($my_var);

Edit
To use markdownify i made a subdir in the libraries directory
/system/application/libraries/markdownify
and put the files in there. Then from the CI guide
- File names must be capitalized. For example: Myclass.php (changed the filenames)
- Class declarations must be capitalized. For example: class Myclass (changed the classname)
- Class names and file names must match.
Load and use the library
Code:
$this->load->library('markdownify/Markdownify_extra');
$md = new Markdownify_Extra;
$my_var = $md->parseString("<b>test</b>");
works fine, outputs **test**
Code:
$this->markdownify_extra->parseString("<b>test</b>"); // also works