From 717e3bb6c396b22f266f2f0d224dcb4e33422638 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 25 Jul 2005 00:33:57 +0000 Subject: [PATCH] Saving token creation code. --- template.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/template.php b/template.php index e94ecf9..a4b73a9 100644 --- a/template.php +++ b/template.php @@ -465,6 +465,15 @@ class DB_Template $stack = array(); $parsed = array(); + // replace tags with tokens + $token_start = '<-|{['; + $token_end = ']}|->'; + + $template = str_replace($tag_start, $token_start . 'TT_IF' . $token_end . '(', $template); + $template = preg_replace('#' . preg_quote('<-|{[TT_IF]}|->(', '#') . '(.*?)' . preg_quote($tag_start_end, '#') . '#', '<-|{[TT_IF]}|->(' . '\\1)<-|{[TT_EIF]}|->', $template); + $template = str_replace($tag_else, $token_start . 'TT_ELSE' . $token_end, $template); + $template = str_replace($tag_end, $token_start . 'TT_ENDIF' . $token_end, $template); + for ($i = 0; $i < strlen($template); $i++) { // we've found ourselves a conditional! -- 2.22.5