Re: [SMARTY-DEV] trimwhitespace outputfilter bug
| From: | messju mohr | Date: | Mon, 10 Mar 2003 22:34:42 +0000 |
| Subject: | Re: [SMARTY-DEV] trimwhitespace outputfilter bug | ||
| References: | 1 2 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-938@lists.php.net to get a copy of this message | ||
On Mon, Mar 10, 2003 at 04:25:02PM -0600, Steve wrote:
> The problem here is that the assignment is the result of a database query.
> The code I sent was just an example to illustrate the problem. How do I
> handle this when a database query is the source of the data for the
> assignment?
>
> Can this be fixed in the outputfilter?
when the data comes from a database and is read to $var, then you
would $smarty->assign('var', $var) and everything is fine.
but if you hardcode it into php, then your php-interpreter interpolates
the $... inside your string, far before it is passed to smarty.
so "$59.95 blah blah" means in the php-sourcecode
"[contents of variable named 59].95 blah blah"
but this is only so inside the php sourcecode and only if you use "
not if you use '. if you pass variables to functions, or read strings
out of a file or a database, no such interpolation is done.
read: http://www.php.net/manual/en/language.types.string.php
have fun
messju
> -----Original Message-----
> From: Monte Ohrt [mailto:monte@ispi.net]
> Sent: Monday, March 10, 2003 8:47 AM
> To: Steve
> Cc: Smarty Dev
> Subject: Re: [SMARTY-DEV] trimwhitespace outputfilter bug
>
>
> $ signs are interperted in double quotes when you assign it. Try one of
> these:
>
> $var = '$59.95 blah blah';
> $var = "\$59.95 blah blah";
>
>
> On Sat, 2003-03-08 at 22:18, Steve wrote:
> > this is a good one:)
> >
> > pseudo code/explanation:
> > .php file:
> > $var = "$59.95 blah blah"
> > $tmpl->load_filter('output', 'trimwhitespace');
> >
> > in template:
> > {$var}<br>
> > <textarea>{$var}</textarea>
> >
> > output:
> > $59.95 blah blah<br>
> > <textarea>.95 blah blah</textarea>
> >
> > I looked at the regex, I'm lost. It's ripping away the $59. Can someone
> > fix this? The filter is great, but not when it breaks the content :)
> >
> > Thanks so much,
> >
> > Steve
> --
> Monte Ohrt <monte@ispi.net>
>
>
> --
> Smarty Development Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> --
> Smarty Development Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--
It is essential that implementations by different vendors interoperate.:
Unsere proprietären Basteleien dokumentieren wir gar nicht erst.
Sven Türpe