views:

123

answers:

2

Hi there!

I'm trying to add some MarkDown capabilities to my symfony project (symfony version 1.3.3). To accomplish that, I had already included the MarkDown library into lib/vendor directory. Also, I added the need configuration in the autoload.yml for the previous library. However, I'm getting a fatal PHP error: Call to undefined function Markdown().

How can I resolve this problem?

Thanks in advance for all the help, Best regards!

+3  A: 

The symfony autoloader loads classes from php files named like <classname>.class.php. If you're using the markdown.php file from mitchelf.com, it does not follow the naming scheme, nor does it contain a class called Markdown, as a matter of fact: it has a function called Markdown.
Symfony isn't even trying to load it, for reasons I described above. You will have to include it manually. I suggest you have a look at http://www.symfony-project.org/plugins/sfEasyMarkdownPlugin.

Maerlyn
Hi there!I will try to install the plugin as you recommended. Thanks for the help,Best regards!
Rui Gonçalves
Hi there!I'm having some problems installing the plugin that you suggested. Can you give some help?Thanks in advance, Best regards!
Rui Gonçalves
How are you trying to install it, and what error do you get? The easiest was is probably to do an svn checkout and enable the plugin manually in your project configuration. After a CC you'll be able to use sfEasyMarkdownHelper::render().
Maerlyn
A: 

I do NOT suggest installing a plugin for such a simple feature. It is not hard for you to figure it out if you have some real examples.

There is an open source project based on symfony named Bookeet. It has embedded MarkDowm feature. It uses markitup as the markdown editor. And it uses php markdown to convert markdown code to html code.

To save your time, go directly to changeset 29f0ba1807 of the Bookeet project(I am sorry that I can't post the hyperlink because SO doesn't permit new user to post more than one hyperlink). You could see clearly what should be done in order to add markdown feature to your website.

Peter Long
the hyperlink to the changeset: http://code.google.com/p/bookeet/source/detail?r=29f0ba18076c8ef546668ab86932984339796413
Peter Long