CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> CodeCharge.Discussion

 BUG -- "$" in Data not parsed correctly

Print topic Send  topic

Author Message
Steven Sutton
Posted: 04/18/2001, 8:07 AM

I noticed this when I created a lookup table that held dollar ranges for a
drop down listbox. But instead of showing:

$1,000,000 to $5,000,000

it would show:
,000,000 to ,000,000

To get this to work I made the following change to the template.php code in
the ProceedTpl function. The change I made fixed my problem but looking at
the code it may also be neccessary to change all occurances of preg_replace
to str_replace to fix all occurances of this type problem. I didn't make
the changes because it is just as likely that without further research on my
part I could easily break the code because I don't know why preg_replace was
chosen over str_replace when this code was written.

function ProceedTpl($sTpl)
{
$vars = $this->blockVars($sTpl,"{","}");
if($vars)
{
reset($vars);
while(list($key, $value) = each($vars))
{
if(preg_match("/^[\w\_][\w\_]*$/",$value))
if(isset($this->ParsedBlocks[$value]))
//changed the following line from preg_replace to str_replace
// $sTpl =
preg_replace("/\{".$value."\}/U",$this->ParsedBlocks[$value],$sTpl);
$sTpl =
str_replace("{".$value."}",$this->ParsedBlocks[$value],$sTpl);
else if(isset($this->DBlocks[$value]))
$sTpl =
preg_replace("/\{".$value."\}/U",$this->DBlocks[$value],$sTpl);
else
$sTpl = preg_replace("/\{".$value."\}/U","",$sTpl);
}
}
return $sTpl;
}


Steven Sutton
Posted: 04/18/2001, 8:09 AM

I should have also mentioned that this was with PHP and Templates connecting
to a MySQL database.


"Steven Sutton" <ssutton@netbotz.com> wrote in message
news:9bkak6$eka$1@mail.tankhill.com...
> I noticed this when I created a lookup table that held dollar ranges for a
> drop down listbox. But instead of showing:
>
> $1,000,000 to $5,000,000
>
> it would show:
> ,000,000 to ,000,000
>
> To get this to work I made the following change to the template.php code
in
> the ProceedTpl function. The change I made fixed my problem but looking
at
> the code it may also be neccessary to change all occurances of
preg_replace
> to str_replace to fix all occurances of this type problem. I didn't make
> the changes because it is just as likely that without further research on
my
> part I could easily break the code because I don't know why preg_replace
was
> chosen over str_replace when this code was written.
>
> function ProceedTpl($sTpl)
> {
> $vars = $this->blockVars($sTpl,"{","}");
> if($vars)
> {
> reset($vars);
> while(list($key, $value) = each($vars))
> {
> if(preg_match("/^[\w\_][\w\_]*$/",$value))
> if(isset($this->ParsedBlocks[$value]))
> //changed the following line from preg_replace to str_replace
> // $sTpl =
> preg_replace("/\{".$value."\}/U",$this->ParsedBlocks[$value],$sTpl);
> $sTpl =
> str_replace("{".$value."}",$this->ParsedBlocks[$value],$sTpl);
> else if(isset($this->DBlocks[$value]))
> $sTpl =
> preg_replace("/\{".$value."\}/U",$this->DBlocks[$value],$sTpl);
> else
> $sTpl = preg_replace("/\{".$value."\}/U","",$sTpl);
> }
> }
> return $sTpl;
> }
>
>
>


   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.