Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jan 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    So simple yet so tricky

    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.
    Last edited by kimtd; 01-24-2007 at 04:00 AM.

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    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.

  • #3
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    Or you can use the $ html entity(sp) for $


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •