SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Member
    Join Date
    Oct 2013
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP & MySQL: Novice to Ninja book - markdown problem

    Hello,

    I've been going through this book because I'm fairly new to PHP. I've come to the section on p261 which indicates to download markdown.php, add it to the project and then add in the new code into helpers include file. I have done this but when I run it I get this error:

    Fatal error: Call to undefined function Markdown() in C:\xampp\htdocs\includes\helpers.inc.php on line 17

    I then downloaded the whole Michelf folder as suggested on the website and updated the path to account for this but I still have the same error. The code is:

    function markdown2html($text)
    {
    $text = html($text);
    include_once $_SERVER['DOCUMENT_ROOT'] . '/includes/Michelf/Markdown.php';
    return Markdown($text);
    }

    Can anyone let me know where I am going wrong?

    Thanks
    Sarah

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,494
    Mentioned
    161 Post(s)
    Tagged
    4 Thread(s)
    did you include markdown.php ?

  3. #3
    SitePoint Member
    Join Date
    Oct 2013
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Yes I included the whole folder as I mentioned above. It has the markdown.php in it.

    Thanks
    Sarah

  4. #4
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    69 Post(s)
    Tagged
    0 Thread(s)
    Call to undefined function would inidicate that markdown.php does not actually contain a function named Markdown. What is the contents of that file?
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.

  5. #5
    SitePoint Zealot moretea's Avatar
    Join Date
    Jun 2004
    Location
    Texas, USA
    Posts
    118
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I'm just a PHP n00b myself, but could it be a matter of referring to Markdown.php vs. markdown.php (case sensitivity)?

  6. #6
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,494
    Mentioned
    161 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by moretea View Post
    I'm just a PHP n00b myself, but could it be a matter of referring to Markdown.php vs. markdown.php (case sensitivity)?
    Yes, that could be the reason

  7. #7
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    69 Post(s)
    Tagged
    0 Thread(s)
    Is the test enviroment set to send out E_ALL errors? If so, you'd have seen a E_WARNING level error on the include line.
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.

  8. #8
    SitePoint Member
    Join Date
    Oct 2013
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've used the example which is:
    function markdownout($text)
    {
    //echo markdown2html($text);
    include_once '...includes/markdown.php';
    return Markdown($text);
    }

    in the markdown.php the function starts: class Markdown {...

    I've taken it out of the folder from the Michelf example to see that is the problem, but now I get no errors just nothing else on the page.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •