View Full Version : So simple yet so tricky

01-24-2007, 03:50 AM
Hi everyone.

This might be a dumb question, but here it is anyway.

I am using PEAR package HTML_Template_IT. It's basically a template engine like Flexy or Smarty. When I attempt to print strings that have the dollar sign ($) in the string, I seem to lose them.

For example, if I have a form w/POST method and I try to display the value, say "$300/hr":

$template->setCurrentBlock("LABOR_COST", $_POST["cost"]);

I only see "0/hr".

I tried so many methods... one method that I saw was suggested here: http://www.php.net/str_replace

They recommend using single quote string, not double quote string, but i don't know how to convert $_POST variables into single quote string..(is there a way?).

Any suggestion is appreciated.

01-24-2007, 06:09 AM
Maybe you are losing the "$" because the template engine is interpreting it as a replacement variable. Try escaping it with a backslash( \$ ) or using two in a row ( $$ ) ... those are two common methods of escaping symbols that otherwise are interpreted in other ways.

01-24-2007, 12:13 PM
Or you can use the $ html entity(sp) for $