Newlines
| From: | Jimmy Harlindong | Date: | Mon, 01 Apr 2002 13:03:27 +0000 |
| Subject: | Newlines | ||
| References: | 1 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-3@lists.php.net to get a copy of this message | ||
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:
/* 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?