SOLVED: icons for docx, xlsx, pptx in listview

Status
Not open for further replies.

bea

Active Member
Hi,
I ran into an issue of displaying icons for docx, xlsx, pptx in listview.
PDF icons are correctly shown in list, but not docx, xlsx, pptx icons.
I have uploaded the icons for the other extensions into media/com_fabrik/images like I did in Fabrik 2, but only the filename is visible in list.

I would appreciate any help. thank you
_bea
 

Attachments

  • Screenshot 2021-07-13 at 11.36.28.png
    Screenshot 2021-07-13 at 11.36.28.png
    31.8 KB · Views: 73
Last edited:
I use Fabrik's list php_events plugin for such cases. In section 'onLoadData' I type something like this:

Code:
$data = $model->getData();
foreach ($data as $group)
{
  foreach ($group as $row)
  {
    if ($row->tablename___element == 'value') {
    $row->tablename___element = '<img src="path/to-desired/icon" />';
    }
  }
}
 
Hi Trembowiecki,

thanks for your reply, but I need a solution for Fabrik and not for each list.
I have several lists with upload elements, where user can upload docx, xlsx, pptx or other files.
Greetings.

fabrikfileupload/models/file.php of Fabrik 2:
PHP:
function render(&$element, &$params, $file)
              {
                            jimport('joomla.filesystem.file');
                            $filename = basename($file);
                            $filename = strip_tags($filename);
                            $ext = JFile::getExt($filename);

                            if (!strstr($file, 'http://') && !strstr($file, 'https://')) {
                                          // $$$rob only add in livesite if we dont already have a full url (eg from amazons3)
                                          $file = ltrim($file, '/\\');
                                          $file = COM_FABRIK_LIVESITE.$file;
                            }
                            $file = str_replace("\\", "/", $file);
                            $file = $element->storage->preRenderPath($file);
                            $thumb_path = COM_FABRIK_BASE.'/media/com_fabrik/images/'.$ext.'.png';
                            // $$$ hugh - using 'make_thumbnail' to mean 'use default $ext.png as an icon
                            // instead of just putting the filename.
                            $this->output .= "<a class=\"download-archive fabrik-filetype-$ext\" title=\"$filename\" href=\"$file\">";
                            if ($params->get('make_thumbnail', false) && JFile::exists($thumb_path)) {
                                          $thumb_file = COM_FABRIK_LIVESITE."media/com_fabrik/images/".$ext.".png";
                                          $filename = "<img src=\"$thumb_file\" alt=\"$filename\" />";
                            }
                            $this->output .= $filename."</a>";
              }
 
Last edited:
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top