How to show PHP code in comments

edited December 2007 in Vanilla 1.0 Help
I've got the HTML Formatter add-on installed, but whenever I put bits of PHP within the <code> tags, they don't show up. Is there an add-on that will help?

Comments

  • edited December 2007
    HTML Formatter (or something else) strips out PHP code for security reasons. Same goes for JavaScript...

    Later...
    I think I misunderstood your question, did you set the format to HTML?
  • <em>did you set the format to HTML?</em> Not sure what you mean.
  • can you post some example of a code you want to be formatted?
  • edited December 2007
    <code><?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php the_content(); ?> <?php endwhile; endif; ?></code> -- Whenever I post the above code to my own forum, it comes up blank.
  • <em>did you set the format to HTML?</em>
    Not sure what you mean.
    Take a look at the comments box below mate, you have 2 options TEXT or HTML...
  • edited December 2007
    you could try to replace < by &lt; this sometimes works on some other forums
  • Take a look at the comments box below mate, you have 2 options TEXT or HTML...

    Right, I don't have those options in my own forum. And when I try to check the box for "Show the comment format type selector when adding comments", it unchecks itself.

    you could try to replace < by <

    Yes, but some folks are posting huge chunks of PHP, they'll probably not want to have to change all the brackets.
  • <code><?php echo "Hello world"; ?></code> produces:

    <?php "Hello world"; ?>
    if you have installed and enabled extension Html Formatter and you select Format comments as Html bellow the comment body input

    Here is copy&paste of your post from above formatted by Html formatter:
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php the_content(); ?> <?php endwhile; endif; ?>
    What's the problem? :-)
  • As I said above, even after installing & enabling HTML Formatter, there is no "Format comments as" option in my comment form.
  • The "Show the comment format type selector when adding comments" unchecks itself -- same problem as this guy:

    http://newwinnipeg.com/community/discussion/2118/
  • Can we see your forum?
  • http://www.darrenhoyt.com/forums/mimbo/
  • Sorry I dont' have time to really look into this, but it might have something to do with TinyMCE. Try disabling TinyMCE and see if that changes anything.
  • That worked great! Thanks Stash.
This discussion has been closed.