Gossamer Forum
Home : Products : Links 2.0 : Customization :

Correction to enhanced template parser

Quote Reply
Correction to enhanced template parser
After upgrading to the September 2, 2004 version of the enhanced template parser (sub parse) in Template.pm from http://www.gossamer-threads.com/...es/Detailed/877.html, my <%if x == 0%> if tags stopped working.

In sub parse, the regular expression matching if tags looks for a single equal sign, although the code below checks for a double equal sign. To correct this problem, change:

Code:
# Check for if tags.
$line =~ s/((.*?)$begin\s*if(not)?\s+(.+?)(\s+(<|>|lt|gt|eq|=)\s*(.+?))?$end(.*))/


to this (add the equal sign shown in bold red):

Code:
# Check for if tags.
$line =~ s/((.*?)$begin\s*if(not)?\s+(.+?)(\s+(<|>|lt|gt|eq|==)\s*(.+?))?$end(.*))/