HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.

HTML codes not showing

edited October 2011 in Vanilla 1.0 Help

I'm running support forum for some PHP scripts and every now and then I need to post some HTML/PHP codes in messages. I was using Vanilla 1.x before and have upgraded to latest version yesterday, but suddenly my HTML codes have disappeared.

Take a look at this comment: http://forums.cubescripts.com/discussion/comment/362#Comment_362

After "1. Open comments/templates/add-comment.php and find following codes: " there is a lot of HTML code but it's not showing up in thread. However, f I choose to edit comment I can see those codes.

I don't want those HTML codes to be parsed, just to be displayed. I'm also using G_SyntaxHighlighter plugin to highlight codes, it worked when I tested it so this also needs to work :)

Any suggestions?

Best Answer


  • jspautschjspautsch Themester ✭✭✭
    I noticed that G_SyntaxHighlighter hides code like HTML and XML unless you specify the language explicitly using the lang attribute. e.g. lang="html"
  • edited October 2011
    I do have <pre lang="html"> and <pre lang="php"> in that message (along with </pre> for each open tag). And couple of sentences outside of those codes :/

    Even here I had to use &lt; and &gt; to mimic < and > but on my forum even &lt; and &gt; are ignored...
  • I didnt have any idea about this. But I observed that, html code is not showing in comments. I am bothering about this. Take needful action please. Thanks in advance.
  • I don't know how G_SyntaxHighlighter works, but indeed it looks like the total html code block is hidden. Maybe it's something that needs to be set besides "lang=html". Good luck finding that solution Avram

  • x00x00 MVP
    edited October 2011
    Why are you using <pre> instead of <code>?

    It could be to do with htmlLawed, basic formating or the conversion. I would try some new comments first.

    grep is your friend.

  • jspautschjspautsch Themester ✭✭✭
    edited October 2011
    He's using pre because that's what G_SyntaxHighlighter requires. For me personally I ditched G_SyntaxHighlighter and went with the pre and code tags that already exist in default Vanilla, I think they work better.
  • edited October 2011
    Well, G_SyntaxHighlighter requires to use PRE tags instead of CODE. But anyways, even without pre/code tags it just ignores all codes.

    I've tried adding new comment and here's what I get:

    <a href="http://avr.am">test html</a>
    <?php echo "test php"; ?>

    ^ this is getting parsed (html, not php)

    <pre lang="html">
    <a href="http://avr.am">test html</a>

    ^ this is somewhat getting parsed - <a> tag gets rel="nofollow" but code is visible and highlighted

    <pre lang="php">
    <?php echo "test php"; ?>

    ^ works fine

    <a href="http://avr.am">test html</a>
    <?php echo "test php"; ?>

    ^ works fine but there's no code highlighting

    I tried to modify G_SyntaxHighlighter plugin to include <code> tags when highlighting but I didn't manage to get it to work.

    Also, on old posts (imported from vanilla 1.x) all codes are still invisible. It's like they're parsed (so, not visible) but even text outside of tags is invisible.

    edit: @jspautsch wrote what I did on top of my message while I was typing my message :)
  • This sound like htmlLawed or other sanitation. turn off the syntax highlighter plugin, is it a problem?

    htmlLawed defaults doesn't like styles for security reasons. This is not becuase of any JavaScript, I turned that off an it is still a problem. The syntax highlighter plugin in addon appears to be JavaScript based in which case that is not the culprit.

    grep is your friend.

  • jspautschjspautsch Themester ✭✭✭
    First I would definitely try disabling the G_SyntaxHighlighter plugin altogether and using Vanilla's pre and code tags and see if that works. That will tell us where to look.
  • I reckon it is nothing to do with the highlighter.

    grep is your friend.

  • please check your db for the imported v1 stuff much sure the code is actually there. It sounds like code disruption to me.

    grep is your friend.

  • As I mentioned, in new comments everything works as expected (almost :)), but problems appear in old comments. The code is in the database as it appears when I choose to edit (old) comment.
  • UnderDogUnderDog Moderator
    Accepted Answer
    Compare in your DB the content of the discussions from Vanilla v1 (old comments) and the new comments. Focus on the field "format"
  • Yeah, old comments/discussions have format Text while new have Html.

    So, can I just to one update on discussions/comments tables and change format from text to html?
  • So, can I just to one update on discussions/comments tables and change format from text to html?
    Sure, I would change 1 or 2 records (discussions /comments) first, to see if that will solve your problem. Then figure out a very easy SQL statement to update the entire table and set the value of Format from 'Text' to 'Html'
Sign In or Register to comment.