WordPress.org

Ready to get started?Download WordPress

Forums

balanceTag and posting code (1 post)

  1. TimoK
    Member
    Posted 7 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic