Support Forums

Old 01-06-2007, 12:46 AM   #1
Senior Member
 
Join Date: Jan 2007
Posts: 123
Rep Power: 14
HotAir is on a distinguished road
Default Variables

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!
HotAir is offline   Reply With Quote
Old 01-06-2007, 09:07 AM   #2
Coder
 
Join Date: Mar 2006
Posts: 4,742
Rep Power: 115
Lhotch is a glorious beacon of lightLhotch is a glorious beacon of lightLhotch is a glorious beacon of light
Default

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.
Lhotch is offline   Reply With Quote
Old 01-07-2007, 10:48 AM   #3
Senior Member
 
Join Date: Jan 2007
Posts: 123
Rep Power: 14
HotAir is on a distinguished road
Default

That worked Larry, thanks!
__________________
V3.1.10 Developer - live
V4.1.0 Beta 2 - sandbox
HotAir is offline   Reply With Quote
Old 01-08-2007, 08:45 AM   #4
Moderator
 
juven14's Avatar
 
Join Date: Mar 2006
Location: Texas
Posts: 2,224
Rep Power: 62
juven14 is a jewel in the rough
Default

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
juven14 is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 08:17 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0