• Hello,

    today I was writing a small how-to for spicing up wordpress with some AJAX ‘magic’ just by adjusting your theme and I ran into a lot of troubles posting the code, because the tag balancing screwed up the code all the time.
    I understand that tag ballancing can not work if you post just closing or opening tags of something, but even after changing my post to stuff like <div class=\"foo\">...</div> the tag balancer stumbled over inline-php ??
    I checked the code and I see why this is happening, but my RegExp-knowledge is not good enough to provide a fix, so I will just try to explain what is going wrong:
    The RegExp in the balanceTag function is /<(\/?\w*)\s*([^>]*)>/
    The problem here is the the ([^>]*) which matches the closing tag of a php block ?> too.
    In ‘natural language’: Instead of an expression that matches “everything but the ‘greater than’-symbol” there should be an expression that matches “everything but the ‘greater than’-symbol” united with “all ‘greater than’-symbols that have a question mark right in front of them.

  • The topic ‘balanceTag and posting code’ is closed to new replies.