i'm working on some customizations to our tpl_product_info_display page. we have a custom field in our database called products_size. I'm trying to dynamically display an image based on the products size. i have created image files for each of the sizes our products come in. (18inch, 28inch, etc)
the code that i've been pulling my hair out on works fine on my local test site via xampp. however, it does not work on the live site. (i'll explain "does not work" more below)
here's the code.when i run this on xampp, it displays the image file perfectly. when i run on a live site, and view the source code, there is a closing double quote appearing after the $inches variable. it should show up in the source asPHP Code:$inches = $product_info->fields['products_size'] ;
if (!empty($product_info->fields['products_size'])) {
print '<img src="images/' . $inches . 'inch.gif">' ; }
but instead i seeHTML Code:<img src="images/18inch.gif">and obviously the image doesn't display.HTML Code:<img src="images/18"inch.gif />
i've tried many variations of the code above. i've tried putting the $product_info->fields['product_size'] directly in the code instead of using the $inches variable.
i've read a lot about variables not behaving properly when they're inside single quotes, so i tried changing all the containing quotes to double, and escaping the quotes that actually needed to appear.
i even tested it by defining a dummy variable, $inches_test = '18', and inserted that in place of $inches in the example above. the variable passed properly and the image displayed fine. it stops working once i use the $product_info->fields['products_size'].. that seems to be what's throwing the extra double quotes into the mix.
no matter what syntax i use, i keep coming back to it working fine locally, but not on my site.
if someone could take a look and let me know where i'm breaking this code, i'd appreciate it.
ps - not sure if it matters, but my local xampp is running php 5.2.4 and the live site runs 5.2.9



