1
Modifications Talk / Help w/ Downloads System
« on: January 25, 2009, 09:47:20 am »
Posted in Latest Mods also, figured this would be a more appropriate board.
Hey guys! I just want to start by saying I have purchased SMF Gallery Pro, and am using Downloads system (obviously) and both are great! Oh, and I'm using SMF 2.0 Beta 4. Basically what I'm trying to do is when you select a category and it lists all the files, I want to add an icon next to the file name based upon the file type. Here's the code I have so far:
File: Themes/default/Downloads2.template.php
Just as a tiny note, for a while I had been using originalfilename for the column name (correct spelling), before discovering the column name had been misspelled. Perhaps this can be fixed in a future release? Anyway, the column name definitely exists, so I don't know what the problem is. It either returns 0 or nothing for $ikon. Any help would be greatly appreciated. Thanks in advance!
Hey guys! I just want to start by saying I have purchased SMF Gallery Pro, and am using Downloads system (obviously) and both are great! Oh, and I'm using SMF 2.0 Beta 4. Basically what I'm trying to do is when you select a category and it lists all the files, I want to add an icon next to the file name based upon the file type. Here's the code I have so far:
File: Themes/default/Downloads2.template.php
Code: [Select]
foreach ($context['downloads_files'] as $i => $file)
{
echo '<tr>';
$fName = $file['orginalfilename'];
$ext = substr(strrchr($fName, '.'), 1);
if(file_exists("Themes/default/images/docType/" . $ext . ".gif"))
$ikon = "http://www.psplockhaven.org/Themes/default/images/docType/" . $ext . ".gif";
else
$ikon = "http://www.psplockhaven.org/Themes/default/images/docType/genericBlue.gif";
echo '<td><img src="' . $ikon . '" alt="' . $ext . '"></td>';
if (!empty($modSettings['down_set_t_title']))
echo '<td><a href="' . $scripturl . '?action=downloads;sa=view;down=', $file['ID_FILE'], '">', $file['title'], '</a></td>';
Just as a tiny note, for a while I had been using originalfilename for the column name (correct spelling), before discovering the column name had been misspelled. Perhaps this can be fixed in a future release? Anyway, the column name definitely exists, so I don't know what the problem is. It either returns 0 or nothing for $ikon. Any help would be greatly appreciated. Thanks in advance!