Numeric modifier parameters

"Mark Rogers" <[email protected]>
Newsgroups gmane.comp.php.smarty.devel
Organization Quarella Ltd
Message-ID <017c01c3fc8b$b55b9e80$1100000a@mark>
I just created a simple modifier "scale_number" which I use thus:
    {$data|scale_number:4:-10:20:50}

The idea was to scale a value between 4 and 20 to one between -10 and 50.

In doing so I discover that this fools Smarty (2.6.0) because of the - sign.
I suspect it is being seen as a calculation:
    ($data|scale_number:4:) - (10:20:50)

Is this behaviour correct/desirable? I got a bit lost trying to see how it
would be fixed - guess I don't know the compiler well enough.

It is possible to work around this with
    {$data|scale_number:4:"-10":20:50}
.. but this is not intuitive.

Note that "." also fools Smarty in a similar way:
    {$data|scale_number:4:10.5:20:50}

-- 
Mark Rogers,
More Solutions Ltd

-- 
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.