SMFHacks.com
** Home Forum Index Hacks Products Login Register Search
Welcome, Guest. Please login or register.
May 24, 2012, 12:57:50 am

Login with username, password and session length
Members
Total Members: 10071
Latest: cdavidson012
Stats
Total Posts: 28685
Total Topics: 4976
Online Today: 47
Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Users: 2
Guests: 52
Total: 54
+ 
|-+ 
| |-+ 
| | |-+ 
| | | |-+ 
| | | | |-+ 
0 Members and 2 Guests are viewing this topic. « previous next »
Pages: [1] Go Down Print
Author Topic: Help with Downloads System  (Read 2086 times)
SNewman
Newbie
*
Offline Offline

Posts: 9


View Profile
« on: January 24, 2009, 01:25:22 am »

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:
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!
Logged
SNewman
Newbie
*
Offline Offline

Posts: 9


View Profile
« Reply #1 on: January 25, 2009, 09:45:41 am »

So can anyone help Huh Is this the correct place to post?
Logged
Pages: [1] Go Up Print 
« previous next »
Jump to:  

Recent
[Today at 12:16:16 am]

[May 21, 2012, 08:54:11 am]

[May 20, 2012, 11:06:52 am]

[May 20, 2012, 05:58:11 am]

[May 19, 2012, 06:16:58 pm]

[May 19, 2012, 05:42:37 pm]

[May 18, 2012, 03:08:38 pm]

[May 17, 2012, 06:07:46 pm]

[May 17, 2012, 02:22:07 pm]

[May 17, 2012, 12:38:16 pm]
Random Picture
Donate to SMFHacks.com
Help Support the SMFHacks.com mod making.
Powered by SMF 1.1.16 | SMF © 2006-2011, Simple Machines LLC
TinyPortal v0.9.7 © Bloc
SMF and SimpleMachines are registered trademarks of Simple Machines. SMFHacks.com is not affiliated with nor endorsed by Simple Machines.
Page created in 0.184 seconds with 19 queries.