Welcome Guest, Not a member yet? Register   Sign In
Using Markdownify with CI, doesn't work? Nothing happens.
#1

[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?
#2

[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..
#3

[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




Theme © iAndrew 2016 - Forum software by © MyBB