Page 1 of 1

if not working

Posted: Tue Jan 11, 2011 10:05 am
by kevrelland
I can't seem to get this if working any ideas?
/If i have it like this

Code: Select all

if ($PriceList == "£0.00") {
	$displayString = "<p class=\"price half_margin\">Free Event</p>"; 	
	} else { 
	$displayString = "<p class=\"price half_margin\">" . $PriceList . "</p>";
	}
	return $displayString;
the else statement works.

if I make it

Code: Select all

if ($PriceList != "£0.00") {
	$displayString = "<p class=\"price half_margin\">Free Event</p>"; 	
	} else { 
	$displayString = "<p class=\"price half_margin\">" . $PriceList . "</p>";
	}
	return $displayString;
the if statement works.

The only thing i can think of is the $PriceList returns the pound symbol as a code, but i have tried &pound; and still the same result, is there anyway i can get $PriceList in a browser without any formatting?
Cheers
Kevin

Re: if not working

Posted: Tue Jan 11, 2011 10:21 am
by TorMike
Your problem is probably the pound symbol as part of the variable. (sorry can't make a pound symbol).

Perhaps if $PriceList was a numeric value (15) then add the pound symbol when you display (sorry I'll use a dollar sign)

Code: Select all

If ($PriceList == 0)
{
  $displayString = "<p class=\"price half_margin\">Free Event</p>";      
} else {
  $displayString = "<p class=\"price half_margin\">[color=#800000][b]$[/b][/color]" . $PriceList . "</p>";
}
return $displayString;
That way you don't have to worry about symbols, work with the value and add the symbol at display.

Re: if not working

Posted: Tue Jan 11, 2011 10:46 am
by social_experiment
Slightly off-topic :

Code: Select all

 <!-- &pound; or &#163; -->
 &pound;