Search code examples
phpcssoscommerce

Adding CSS class attribute to osCommerce tep_image


Possible Duplicate:
Adding class attribute to osCommerce tep_image function

I need to add an ID or a class to an image in osCommerce so that I can resize it using media queries.

I have tried adding class="classname" all over this statement but it always fails to work.

A similar question on tep_image doesn't seem to fit due to the 'bts_select' in my case.

tep_image(bts_select(images, 'logo' . (ITS_CHRISTMAS == 'true' ? '-xmas' : '') . '.gif'), STORE_NAME) . '</a>'

Solution

  • The tep_image() function is not documented but the source code is fairly straightforward:

    function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '') {
        //[...]
        if (tep_not_null($parameters)) $image .= ' ' . $parameters;
    
        $image .= ' />';
    
        return $image;
    }
    

    The fifth parameter gets injected as-is right before the end tag. That's all you need.