Display icon or image based on another field

Nimeshin

New Member
Hi

I have a field in my form using eval and php code that checks another table in my joomla database and displays Yes or No based on the info from the other table.

This works fine and displays the text Yes or No in the list view and details view.

I now want to display an icon instead of yes or no. Yes must display tick.jpg icon and No must display cross.jpg icon

Any ideas how i can display different icons?

Thanks
 
This is the code that displays my yes no text


Code:
$user = JFactory :: getUser();
$db = JFactory :: getDBO();
$query_form = $db->getQuery(true)
            ->select('avatar')
                    ->from('#__comprofiler')
          ->where('id = ' . (int) $user->id);
                $db->setQuery($query_form);
        $val_form = $db->loadResult();
        $Yes = 'Yes';
        $No = 'No';
        if($val_form == '')
            {
                    return $No;
             
          }
          else
            {
                return $Yes;
            }
 
This is how I display icons. You should be able to return something like this instead of the 'Yes' / 'No'
Code:
$booticon = "{mc_mi_priority___booticon}";
$myval="";
if ($booticon != null) {
  $myval = '<i class="condensed-icon '.$booticon;
  $myval.= '">';
  $myval.= '</i>';
}
Result: <i class="condensed-icon sort1 icon-warning color-yellow"></i>
You can add text as well: <i class="condensed-icon sort1 icon-ok color-green"></i> Yes
return $myval;
 
We are in need of some funding.
More details.

Thank you.

Staff online

Back
Top