Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Forum Stats

Members
Total Members: 4257
Latest: Alex998.
New This Month: 1
New This Week: 0
New Today: 0
Stats
Total Posts: 43295
Total Topics: 7523
Most Online Today: 236
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 215
Total: 215

Author Topic: SSI function  (Read 6668 times)

0 Members and 1 Guest are viewing this topic.

Offline Vincent Volmer

  • Hero Member
  • *****
  • Posts: 519
  • SMF 2.0.17
    • View Profile
    • Digiscrap.nl
SSI function
« on: May 03, 2009, 10:46:57 am »
Hello mr. SMFHacks,

I'm trying to get an SSI function working for the Downloads MOD but I'm breaking my head over it... haha

It's working for the 'light' version of this MOD but now I would like to display the thumbnails to. Could you please help with the query and how to display the images. For the rest I can add it manual to the SSI.php of course. See the code below.

Thanks in advance....!
Vincent

Code: [Select]
//Begin Random Downloads horizontaal
function ssi_downloads_randomdownloads_hor_img( $limit = 5, $output_method = 'echo')
{
   global $smcFunc, $modSettings, $boardurl, $scripturl, $txt;

    $limit = (int)  $limit;
   
$dbresult = $smcFunc['db_query']('', "
SELECT
p.ID_FILE, p.totalratings, p.rating, p.commenttotal,
p.filesize, p.views, p.title, p.ID_MEMBER, m.real_name,
p.date, p.description, p.totaldownloads, f.thumbfilename, f.ID_PICTURE,
mg.online_color
FROM {db_prefix}down_file as p
LEFT JOIN {db_prefix}members AS m ON (p.ID_MEMBER = m.ID_MEMBER)
LEFT JOIN {db_prefix}membergroups AS mg  ON (m.ID_GROUP = mg.ID_GROUP)
LEFT JOIN {db_prefix}down_file_pic AS f ON (f.ID_PICTURE = p.ID_PICTURE)
WHERE  p.approved = 1 GROUP by RAND() LIMIT $limit");

echo '<center><table cellspacing="20"><tr>';

   if ($output_method == 'echo')
   {
     while($row = $smcFunc['db_fetch_assoc']($dbresult))
     {

      echo '<td width="120"><div align="center"><a href="' . $scripturl . '?action=downloads;sa=view;down=' . $row['ID_FILE'] . '"><img src="',$modSettings['down_url'] . $row['thumbfilename'] . '" alt="' .$row['title'] . '" /></a><br />';

      if ($row['real_name'] != '')
         echo 'Aangeboden door: <br /> <a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">'  . $row['real_name'] . '</a><br />' . timeformat($row['date']) . '';
     
      else
         echo $txt['downloads_text_by'] . ' ' . $txt['downloads_guest'] . '';
         
      echo '</div></td>';
     }
     $smcFunc['db_free_result']($dbresult);
     
   }
   else
   {  $data = array();
      while($row = $smcFunc['db_fetch_assoc']($dbresult))
      {
         $data[] = $row;
      }
     
     
      return $data;
   }
echo '</tr></table></center>';

}

//END Random downloads horizontaal

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16452
    • View Profile
Re: SSI function
« Reply #1 on: May 03, 2009, 04:03:51 pm »
Made a couple small changes should work good now
Code: [Select]
//Begin Random Downloads horizontaal
function ssi_downloads_randomdownloads_hor_img( $limit = 5, $output_method = 'echo')
{
   global $smcFunc, $modSettings, $boardurl, $scripturl, $txt;

    $limit = (int)  $limit;
   
    if (empty($modSettings['down_url']))
$modSettings['down_url'] = $boardurl . '/downloads/';
   
$dbresult = $smcFunc['db_query']('', "
SELECT
p.ID_FILE, p.totalratings, p.rating, p.commenttotal,
p.filesize, p.views, p.title, p.ID_MEMBER, m.real_name,
p.date, p.description, p.totaldownloads, f.thumbfilename, f.ID_PICTURE,
mg.online_color
FROM ({db_prefix}down_file as p)
LEFT JOIN {db_prefix}members AS m ON (p.ID_MEMBER = m.ID_MEMBER)
LEFT JOIN {db_prefix}membergroups AS mg  ON (m.ID_GROUP = mg.ID_GROUP)
LEFT JOIN {db_prefix}down_file_pic AS f ON (f.ID_PICTURE = p.ID_PICTURE)
WHERE  p.approved = 1 GROUP by RAND() LIMIT $limit");

echo '<center><table cellspacing="20"><tr>';

   if ($output_method == 'echo')
   {
     while($row = $smcFunc['db_fetch_assoc']($dbresult))
     {

      echo '<td width="120"><div align="center">';
      echo '
      <a href="' . $scripturl . '?action=downloads;sa=view;down=' . $row['ID_FILE'] . '">';
     
      if (!empty($row['thumbfilename']))
      echo '<img src="',$modSettings['down_url'] . $row['thumbfilename'] . '" alt="' .$row['title'] . '" />';
      else
      echo $row['title'];
     
     echo '</a><br />';

      if ($row['real_name'] != '')
         echo 'Aangeboden door: <br /> <a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">'  . $row['real_name'] . '</a><br />' . timeformat($row['date']) . '';
     
      else
         echo $txt['downloads_text_by'] . ' ' . $txt['downloads_guest'] . '';
         
      echo '</div></td>';
     }
     $smcFunc['db_free_result']($dbresult);
     
   }
   else
   {  $data = array();
      while($row = $smcFunc['db_fetch_assoc']($dbresult))
      {
         $data[] = $row;
      }
     
     
      return $data;
   }
echo '</tr></table></center>';

}

//END Random downloads horizontaal
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline Vincent Volmer

  • Hero Member
  • *****
  • Posts: 519
  • SMF 2.0.17
    • View Profile
    • Digiscrap.nl
Re: SSI function
« Reply #2 on: May 03, 2009, 04:32:10 pm »
Made a couple small changes should work good now


Thank you very much for your support on this! Its looking very nice (see attachment).

Vincent
« Last Edit: May 03, 2009, 04:36:53 pm by Vincent Volmer »

 

Related Topics

  Subject / Started by Replies Last post
2 Replies
6660 Views
Last post May 04, 2009, 04:08:15 pm
by clintre
3 Replies
5777 Views
Last post July 22, 2008, 07:24:47 pm
by SMFHacks
4 Replies
5371 Views
Last post January 18, 2009, 03:44:17 pm
by SMFHacks
10 Replies
8967 Views
Last post July 26, 2009, 09:12:11 am
by Darkshadow
1 Replies
3782 Views
Last post September 17, 2011, 06:50:26 pm
by SMFHacks

+- Recent Topics

Please Help! by SMFHacks
April 17, 2024, 08:04:55 am

Rate own images by fvlog19
April 11, 2024, 10:56:53 am

Tidy Child Boards on 2.1.4 by SMFHacks
April 04, 2024, 03:54:12 pm

Problems SMF 2.0.19 > 2.1.4 SMF Gallery Pro - Recents Images to overall header by Michel68
March 30, 2024, 12:41:08 pm

Can't DROP 'id_member'; check that column/key exists Datei: by SMFHacks
March 30, 2024, 11:58:20 am

No thumbnails on new uploads by Tonyvic
March 29, 2024, 06:26:18 am

Display the Contact Page for guests by SMFHacks
March 27, 2024, 10:55:43 am

is it possible to add support for odysee.com by fvlog19
March 21, 2024, 08:47:51 am

Request for admin notification by davejo
March 10, 2024, 01:31:59 am

I need help with torrent upload by Ineedsmfhelp
March 09, 2024, 10:01:13 pm

Powered by EzPortal