Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-24-2007, 02:50 AM   PM User | #1
kimtd
New to the CF scene

 
Join Date: Jan 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
kimtd is an unknown quantity at this point
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 03:00 AM..
kimtd is offline   Reply With Quote
Old 01-24-2007, 05:09 AM   PM User | #2
Fumigator
UE Antagonizer


 
Fumigator's Avatar
 
Join Date: Dec 2005
Location: Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
Posts: 7,686
Thanks: 42
Thanked 637 Times in 625 Posts
Fumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of light
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.
__________________
Fumigator is offline   Reply With Quote
Old 01-24-2007, 11:13 AM   PM User | #3
Nightfire
Senior Coder

 
Nightfire's Avatar
 
Join Date: Jun 2002
Posts: 4,266
Thanks: 6
Thanked 48 Times in 48 Posts
Nightfire is on a distinguished road
Or you can use the $ html entity(sp) for $
__________________
Blue Panda
Website Design | 1 Pound Ads | 'ow much? | Coding Geeks
Nightfire is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:27 PM.


Advertisement
Log in to turn off these ads.