|
|
#1 |
|
Senior Member
Join Date: Jan 2007
Posts: 123
Rep Power: 14 ![]() |
Hi,
I just purchased the dev version today and have begun editing my templates. I'm having a difficult time wioth one variable, and hope someone knows the answer: I'm setting the value of the price using a hidden input on the page where a new ad is entered. When the list of ads in that category are displayed, degug shows the value of this variable as: price => $2.00 I'm then testing for the value of this variable in the showlistings.tpl.php template. I've tried several ways: {if $entry.price == "$2.00"} {if $entry.price == $2.00} {if $entry.price == "2.00"} {if $entry.price == "2"} {if $entry.price == 2} But none of these work. I'm sure it's the way I have the above IF statement written -- what am I doing wrong? Thanks! |
|
|
|
|
|
#2 |
|
Coder
Join Date: Mar 2006
Posts: 4,742
Rep Power: 115 ![]() ![]() ![]() |
For some reason the dollar sign throws off smarty. You can try removing it in the comparison using replace, something like this.
{if $entry.price|replace:'$':'' == "2.00"}
__________________
Larry What I post here should be used only as a guide to point you in the right direction. If the code I post doesnt make any sense or work as posted then you should spend more time reading the various manuals and tutorials so it does make sense and you can tweak it to work. A sure fire way to get yourself in trouble is to implement changes you dont have an intimate understanding of. Im happy to help, but I am not here to teach you to code or create your site for you. |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Jan 2007
Posts: 123
Rep Power: 14 ![]() |
That worked Larry, thanks!
__________________
V3.1.10 Developer - live V4.1.0 Beta 2 - sandbox |
|
|
|
|
|
#4 |
|
Moderator
|
I believe there is a slash in there and that is why the check isn't working:
/$2.00 I think there is a thread where another member found this one. Just in case you want to compare it as is.
__________________
John Snyder PHP Developer |
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Looking for list of variables. | BigOrange | HTML, CSS, and Design Help | 7 | 10-06-2006 02:55 PM |
| List of Smarty Variables and Arguments? | bgordon | v3.1 Modules & Modifications | 5 | 09-12-2006 03:06 PM |
| Smarty Variables for Featured Listings? | bgordon | v3.1 Questions & Support | 7 | 09-12-2006 12:50 PM |
| Help with emailing global variables | ichversuchte | v3.1 Questions & Support | 0 | 08-20-2006 10:30 PM |
| using passed variables | gregbatch | v3.1 Modules & Modifications | 7 | 06-20-2006 08:37 PM |