Plugin

Developer
Supported

Browser Sniff

ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From Laisvunas

     

You must be logged in to post.

white space at the end

Support Request

Juan Carlos
Juan Carlos

Hi, i’m using code like this:

{exp:ce_cache:escape}
{if browser_sniff_negotiated_language 
== "en-us" OR browser_sniff_negotiated_language == "es-419" OR browser_sniff_negotiated_language == "es-ar" OR browser_sniff_negotiated_language == "es-cl" OR browser_sniff_negotiated_language == "es-us"}
129
{if
:elseif browser_sniff_negotiated_language == "en-gb"}
£ 84.5
{if
:elseif browser_sniff_negotiated_language == "es-mx"}
MXN 1791
{if
:else}
99
,5 €
{
/if}
{
/exp:ce_cache:escape} 

and i’ve found it adds a white space at the end. I kinda fixed this modifying the html after the price but now i need to use conditionals to put the currency code into an url, and here i need to not have any white space at all after resulting code. Any quick fix?

Regards,

Juan Carlos
# 1
Juan Carlos

Bt the way the browser sniff tag doesn’t appear here because it’s placed at beginning and end of the page, the code shown here works perfectly except for the white space at the end.

Regards,

Laisvunas
# 2
Developer
Laisvunas

Hi,

What you exactly mean by “white space at the end”?

Juan Carlos
# 3
Juan Carlos

Hi Laisvunas,

I mean that the resulting text for the above code is “99,5 € ” for example, instead of “99,5 €”. Same for all the other conditionals, “MXN 1791 ” instead of “MXN 1791”, etc. always with an extra blank space at the end.

Regards,

Laisvunas
# 4
Developer
Laisvunas

HiJuan,

This isn’t bug. If you want to avoid white space, then just dont leave the white space in your conditionals. So, you code should be:

{exp:ce_cache:escape}
{if browser_sniff_negotiated_language 
== "en-us" OR browser_sniff_negotiated_language == "es-419" OR browser_sniff_negotiated_language == "es-ar" OR browser_sniff_negotiated_language == "es-cl" OR browser_sniff_negotiated_language == "es-us"}129{if:elseif browser_sniff_negotiated_language == "en-gb"}£ 84.5{if:elseif browser_sniff_negotiated_language == "es-mx"}MXN 1791{if:else}99,5 €{/if}
{
/exp:ce_cache:escape}