From 51fc7ea20de8f1f96b30cd2344c4404f02cc4dbd Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Fri, 18 Mar 2005 08:32:02 +0000 Subject: [PATCH] It's kind of working... not really, though. Bed time so I can't finish this now :-(. --- template.php | 77 ++++++++++++++++++---------------------------------- 1 file changed, 27 insertions(+), 50 deletions(-) diff --git a/template.php b/template.php index f9baf46..5f7cdd6 100644 --- a/template.php +++ b/template.php @@ -441,62 +441,39 @@ class DB_Template // get the full condition $fullspread = substr($template, $last, $end - $last); - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $fullspread >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"; + + // remove the beginning tag + $conditional = substr($fullspread, strlen($tag_start)); + + // find the end of the expression + $temp_end = strpos($conditional, $tag_start_end); + + // save the expression + $expression = stripslashes(substr($conditional, 0, $temp_end)); + + // remove the condition from the broken conditional + $conditional = substr($conditional, strlen($expression) + strlen($tag_start_end)); + + // remove the tailing end tag + $conditional = substr($conditional, 0, strlen($conditional) - strlen($tag_end)); + + // place it in iff() + $parsed = '" . iff(' . stripslashes($expression) . ',"' . $conditional . '","") . "'; + + // replace it back into the template + $template = substr_replace($template, $parsed, $i, $end); + + //echo "<<<<<<<<<<<<<<<<< $conditional >>>>>>>>>>>"; } } } - exit; + return $template; + // ------------------------------ + // ------ END + //exit; while (1) { - // Finds the start tag: starts looking through the haystack one position - // after the old startpoint - $location_start = strpos($template, $tag_start, $location_start + 1); - if ($location_start === false) - { - break; - } - - // Finds the end tag: starts looking through the haystack after the old end - // tag - $location_end = strpos($template, $tag_end, $location_end + strlen($tag_end)); - if ($location_end === false) - { - break; - } - - // Split the template expression out of the template data - $expression = substr($template, $location_start, ($location_end + strlen($tag_end)) - $location_start); - - echo("\n\n\n\nexpression: " . $expression); - - echo " ||||| >>>>>> ||||| >>>>> " . substr_count($expression, $tag_end); - - // If we have a nested expression, work it out by setting - // the search counters to be one and two after the current - // start point - if (substr_count($expression, $tag_end) > 1) - { - $_isso->debug("resetting search counters: $location_start | $location_end"); - $location_start = $location_start + 1; - $location_end = $location_start + 2; - } - - // Strip out the opening '