X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Smarty code to check file exstention (https://forum.x-cart.com/showthread.php?t=41834)

pixelposh 08-18-2008 01:04 PM

Smarty code to check file exstention
 
Hi All, Hope the Xcart pro's can help me out here. Been battling on this one.

Is there a way i can check what the product image file extension is using smarty code?

i want to replace the main product image with a swf file, but I want the smarty code to first check if the product image is an image or flash file. so something like this

if {product extention is .swf}
include product_thumnail_flash.tpl
elseif {product extention is jpg}
include product_thumnail.tpl
/if

hope this makes sense.

Thanks

geckoday 08-19-2008 11:19 AM

Re: Smarty code to check file exstention
 
Assuming you are doing this in product.tpl, try:

{if $product.tmbn_url|substr:-3 eq "swf"}
include ...
{else}
include ...
{/if}

If you are doing this in product_thumbnail.tpl use $tmbn_url instead of $product.tmbn_url

pixelposh 08-19-2008 09:15 PM

Re: Smarty code to check file exstention
 
Hi Ralph, Thats perfect ;) , exactly what i was looking for. Thanks for your help.


All times are GMT -8. The time now is 05:38 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.