Hello

On my site I list hotels, the hotels have various facilites attached to them, on the listings page these facilites are shown as icons representing each facility, in the index for each region the facilites are listed as text, I have been trying to get the index pages to also show the icons but cannot get them to display.

The code that is in the listing page that works correctly is below, it seems to work by having the name of the facility the same as the image name in .gif format, this code also calls nearby facilities, facilities and hotel types

PHP Code:
$arr = array('item_types''facilities''nearby_facilities'); 
        foreach(
$arr as $key => $val) { 
            
$sql_items $this->db->QFetchRowArray("SELECT * FROM {$this->tables['fields']} WHERE (field='{$val}') ORDER BY id ASC;");
            
           if (
$val == 'nearby_facilities'$miles explode(','$this->currentItem['nearby_miles']);
           
$arr_items = array(); 
            foreach(
explode(','$this->currentItem[$val]) as $key_item => $val_item) {
                 if (!empty(
$val_item) && !empty($sql_items[$key_item]['value'])) {
                     if (
$val == 'nearby_facilities') if ($miles[$key_item] == 1array_push($arr_items$sql_items[$key_item]['value'] . ' - ' $miles[$key_item] . ' Mile');
                     else 
array_push($arr_items$sql_items[$key_item]['value'] . ' - ' $miles[$key_item] . ' Miles');
                     else 
array_push($arr_items$sql_items[$key_item]['value']);
                 } 
            } 
            if (
$val == 'nearby_facilities'$this->currentItem[$val] = implode('<br />'$arr_items);
             else if (
$val == 'facilities') { 
                
sort($arr_items); 
                foreach(
$arr_items as $key_item => $val_item) { 
                    
$val_item_img str_replace("'"''$val_item); 
                    
$val_item_img str_replace(chr(146), ''$val_item_img); 
                    
$image strtolower(str_replace(' ''_'$val_item_img)) . '.gif';
                     
$arr_items[$key_item] = "<div class='list_facilities_img'><img src='_layouts/images/facilities/{$image}' alt='$val_item' /> $val_item</div>";
                } 
                
$this->currentItem[$val] = implode(''$arr_items); 
            } 

The code below is the code to call the facilities in the index pages, this shows the facilities but in text format, i have tried just replacing with the above that relates to the facilities but it fails to show, it just displays a series of 1 and 0's

PHP Code:
        $facilities '';
        
$sql_items $this->db->QFetchRowArray("SELECT * FROM {$this->tables['fields']} WHERE (field='facilities') ORDER BY id ASC;");
        
$arr_items = array();
        foreach(
explode(','$vars['facilities']) as $key_item => $val_item
        if (!empty(
$val_item) && !empty($sql_items[$key_item]['value'])) array_push($arr_items$sql_items[$key_item]['value']);
        
$vars['facilities'] = implode(', '$arr_items);
        if (!empty(
$vars['facilities'])) $vars['facilities'] = ' ' $vars['facilities'];
        else 
$vars['facilities'] = '';
        
        
        else if (
$val == 'facilities') {
        
sort($arr_items); 
Thanks John