Re: [SMARTY-DEV] Newlines
| From: | Jason Sweat | Date: | Wed, 03 Apr 2002 04:25:48 +0000 |
| Subject: | Re: [SMARTY-DEV] Newlines | ||
| References: | 1 2 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-9@lists.php.net to get a copy of this message | ||
I did some further testing because I encountered the same problem. It has
to do with postfilter.trimwhitespace.php
No postfilter, no problem. Or as another temporary solution if you want to
keep the postfilter, hard code a non-breaking space in between the var and
the text (i.e. {$var} text). I am not sufficiently adept with regexp
to solve the problem, but at least it is better identified.
Jason
----- Original Message -----
From: "Monte Ohrt" <monte@ispi.net>
To: "Jimmy Harlindong" <jimmy@harlindong.com>
Cc: <smarty-dev@lists.php.net>
Sent: Tuesday, April 02, 2002 9:11 AM
Subject: Re: [SMARTY-DEV] Newlines
> 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:
> >
> > /* 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.
>
>
> --
> Smarty Development Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>