Re: [SMARTY-DEV] Newlines
| From: | Monte Ohrt | Date: | Tue, 02 Apr 2002 15:11:52 +0000 |
| Subject: | Re: [SMARTY-DEV] Newlines | ||
| References: | 1 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-8@lists.php.net to get a copy of this message | ||
I cannot reproduce this problem. Here is my simple test:
index.tpl
---------
begin
TESTING {$var} test
TESTING2 {$var}
test
done
OUTPUT
------
begin
TESTING foo test
TESTING2 foo
test
done
This is exactly the output I would expect. Something else must be affecting the output. Are you putting strip around this, or do you have pre/post filters that may affect it? strip would take carriage returns off of the beginning and ends of lines, but it should not affect "{$var} text" if they are together.
Jimmy Harlindong wrote:
When I have $var = "abc" and inside the template: {$var} text the output will be "abctext" 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:-- Monte Ohrt <monte@ispi.net> Director of Technology, ispi Inc./* If the tag name matches a variable or section propertydefinition,we simply process it. */ if(preg_match('!^\$\w+(?>(\[(\d+|\w+(\.\w+)?)\])|((\.|->)\w+))*(?>\|@?\w+( :(?>' . $qstr_regexp . '|[^|]+))*)*$!', $tag_command) || // if a variablepreg_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 REMOVEDthe \n at the end}Any comments? Or perhaps there is a workaround to this problem?