Re: [SMARTY-DEV] Newlines

From: Date: Mon, 01 Apr 2002 14:34:32 +0000
Subject: Re: [SMARTY-DEV] Newlines
References: 1  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-4@lists.php.net to get a copy of this message
Jimmy Harlindong wrote:
When I have $var = "abc" and inside the template: {$var} text the output will be "abctext"
This shouldn't happen, the space should be there as you would intend. What version of Smarty are you using? I just did a simple test and it looks OK to me.
How do I make it into "abc text" (with space there) On another case: get "abctext" only when I write {$var}text in the template? This seems to work: Smarty_compiler.class.php inside _compile_tag() function:
        /* If the tag name matches a variable or section property
definition,
           we simply process it. */
        if
(preg_match('!^\$\w+(?>(\[(\d+|\w+(\.\w+)?)\])|((\.|->)\w+))*(?>\|@?\w+( :(?>' . $qstr_regexp . '|[^|]+))*)*$!', $tag_command) || // if a variable
            preg_match('!^#(\w+)#(?>\|@?\w+(:(?>' . $qstr_regexp .
'|[^|]+))*)*$!', $tag_command)     ||  // or a configuration variable
            preg_match('!^%\w+\.\w+%(?>\|@?\w+(:(?>' . $qstr_regexp .
'|[^|]+))*)*$!', $tag_command)) {    // or a section property
            settype($tag_command, 'array');
            $this->_parse_vars_props($tag_command);
            return "<?php echo $tag_command[0]; ?>"; <<<<<<<< I REMOVED
the \n at the end
        }
Any comments? Or perhaps there is a workaround to this problem?
-- -- Monte Ohrt <monte@ispi.net> Director of Technology, ispi Inc.

« previous php.smarty.dev (#4) next »