We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Displaying markdown file in my Phalcon project

Hello everyone,

I am wondering how to include markdown file in my phalcon project.

Basically, if I have the following helloWorld.md in my public/mardown/ folder:

Hello World
====

Hello World Content

I would like to diplay this content (with a markdown rendering) within a random view... let's say app/views/index.volt. I guess this must be really trivial, but i have to admit that I am quite lost in the documentation.

Thank you in advance



16.3k

Hi, you can use extensions, just search on google or packagist, eg: https://packagist.org/packages/michelf/php-markdown



125.8k
Accepted
answer

You need to register a new view engine for markdown files. There's one already built, though the site's in Japanese - the code shouldn't be. https://hiden.samurai-factory.jp/php/phalcon_markdown/

You can register multiple view engines, so I'd suggest just using this new engine on .md files, so you can still have the option of using Volt for .volt files.



1.7k
edited Jun '14

@quasipickle @Sum Thank you for both your answer, I found the packagist website well documented and I am currently studying it. Also, I select quasipickle anser as the good one since it is directly answering the question (although both answer really suited to my question)

EDIT: @Sum Sorry, I accepted really late, the fact is at this moment the server told me I had not enough reputation for accepting... See you soon on this forum for sure (I plan to spend more and more time on my own server as soon as possible, phalcon is really amazing, even for beginner).



16.3k

U can accept the answer then :-)