SMFHacks.com
SMFHacks
Community Suite
SMF Gallery Pro
SMF Store
SMF Classifieds
Newsletter Pro
Downloads System Pro
Ad Seller Pro
Hacks and Mods
Latest SMF Hacks
TopTen Hacks
Styles and Themes
Add a Hack
Manage Hacks
Earn Money from Your Forum with these tips
SMF Theme Generator
SMF Package Parser
Free SMF Hosting
HostRocket Webhosting for SMF
Site Showcase
Search Forums
Advanced search
User
Welcome,
Guest
. Please
login
or
register
.
May 25, 2012, 01:30:56 pm
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Stats
Members
Total Members: 10073
Latest:
makablue
Stats
Total Posts: 28694
Total Topics: 4979
Online Today: 88
Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Users: 0
Guests: 79
Total: 79
SMFHacks.com
Forum
Downloads System Pro
Support
Latest Downloads Block for Tiny Portal
0 Members and 2 Guests are viewing this topic.
« previous
next »
Pages:
[
1
]
Author
Topic: Latest Downloads Block for Tiny Portal (Read 691 times)
shaka
Downloads Pro Customer
Newbie
Offline
Posts: 20
Latest Downloads Block for Tiny Portal
«
on:
January 21, 2012, 08:52:18 pm »
Hi guys sorry if this is already done but I have searched and cannot find it
I am looking for a code to add a latest downloads block for tiny portal
Logged
SMFHacks
Administrator
Hero Member
Offline
Posts: 9680
Re: Latest Downloads Block for Tiny Portal
«
Reply #1 on:
January 21, 2012, 08:53:48 pm »
What do you want to show? A listing of latest downloads? And how do you want it to be formatted?
Logged
shaka
Downloads Pro Customer
Newbie
Offline
Posts: 20
Re: Latest Downloads Block for Tiny Portal
«
Reply #2 on:
January 21, 2012, 09:02:30 pm »
Yes much like the layout on the downloads page showing the title and image but would like to put it in a block and display it on my index page e.g Latest 50 downloads added
hope I am explaining this ok
Logged
SMFHacks
Administrator
Hero Member
Offline
Posts: 9680
Re: Latest Downloads Block for Tiny Portal
«
Reply #3 on:
January 21, 2012, 11:16:08 pm »
Now is the download image a screenshot or a download link?
Vertical like this?
Title
Download Image
Title
Download Image
Logged
shaka
Downloads Pro Customer
Newbie
Offline
Posts: 20
Re: Latest Downloads Block for Tiny Portal
«
Reply #4 on:
January 22, 2012, 03:59:42 am »
A screenshot would be great with maybe a link either from the image or title to the download page of that download
Logged
SMFHacks
Administrator
Hero Member
Offline
Posts: 9680
Re: Latest Downloads Block for Tiny Portal
«
Reply #5 on:
January 23, 2012, 07:43:32 pm »
One more thing I need what SMF version then will write a quick code.
Logged
shaka
Downloads Pro Customer
Newbie
Offline
Posts: 20
Re: Latest Downloads Block for Tiny Portal
«
Reply #6 on:
January 24, 2012, 02:37:47 am »
Running the latest version 2.0.2 many thanks
before you go ahead and if possible I am only looking for the preview image, title and uploader info to be displayed, just if possible but I will be grateful whatever you can come up with
thanks
Logged
SMFHacks
Administrator
Hero Member
Offline
Posts: 9680
Re: Latest Downloads Block for Tiny Portal
«
Reply #7 on:
January 24, 2012, 06:16:07 pm »
Try this code adapted from ezPortal
Code:
//Example call
DownloadsBlock(1,4,'recent');
function DownloadsBlock($rows = 4, $files = 4, $type = 'recent')
{
global $txt, $smcFunc, $scripturl, $modSettings, $scripturl, $boardurl;
$rows = (int) $rows;
$files = (int) $files;
$isPro = true;
// Load the language files
if (loadlanguage('Downloads') == false)
loadLanguage('Downloads','english');
if (empty($modSettings['down_url']))
$modSettings['down_url'] = $boardurl . '/downloads/';
$maxrowlevel = $rows;
echo '<table cellspacing="0" cellpadding="5" border="0" align="center" width="100%">
';
//Check what type it is
$selectPro = '';
$selectProJoin = '';
if ($isPro == true)
{
$selectPro = " f.ID_PICTURE, f.thumbfilename, ";
$selectProJoin = " LEFT JOIN {db_prefix}down_file_pic AS f ON (f.ID_PICTURE = p.ID_PICTURE) ";
}
$query = ' ';
switch($type)
{
case 'recent':
$query = "SELECT p.ID_FILE, p.commenttotal, $selectPro p.totalratings, p.rating, p.filesize, p.views, p.title, p.ID_MEMBER, m.real_name, p.date, p.description, p.totaldownloads
FROM {db_prefix}down_file as p
LEFT JOIN {db_prefix}members AS m ON (m.ID_MEMBER = p.ID_MEMBER)
$selectProJoin
WHERE p.approved = 1 ORDER BY p.ID_FILE DESC LIMIT $files";
break;
case 'viewed':
$query = "SELECT p.ID_FILE, p.commenttotal, $selectPro p.totalratings, p.rating, p.filesize, p.views, p.title, p.ID_MEMBER, m.real_name, p.date, p.description, p.totaldownloads
FROM {db_prefix}down_file as p
LEFT JOIN {db_prefix}members AS m ON (m.ID_MEMBER = p.ID_MEMBER)
$selectProJoin
WHERE p.approved = 1 ORDER BY p.views DESC LIMIT $files";
break;
case 'mostcomments':
$query = "SELECT p.ID_FILE, p.commenttotal, $selectPro p.totalratings, p.rating, p.filesize, p.views, p.title, p.ID_MEMBER, m.real_name, p.date, p.description, p.totaldownloads
FROM {db_prefix}down_file as p
LEFT JOIN {db_prefix}members AS m ON (m.ID_MEMBER = p.ID_MEMBER)
$selectProJoin
WHERE p.approved = 1 ORDER BY p.commenttotal DESC LIMIT $files";
break;
case 'toprated':
$query = "SELECT p.ID_FILE, (p.rating / p.totalratings ) AS ratingaverage, p.commenttotal, $selectPro p.totalratings, p.rating, p.filesize, p.views, p.title, p.ID_MEMBER, m.real_name, p.date, p.description, p.totaldownloads
FROM {db_prefix}down_file as p
LEFT JOIN {db_prefix}members AS m ON (m.ID_MEMBER = p.ID_MEMBER)
$selectProJoin
WHERE p.approved = 1 ORDER BY ratingaverage DESC LIMIT $files ";
break;
case 'downloads':
$query = "SELECT p.ID_FILE, p.commenttotal, $selectPro p.totalratings, p.rating, p.filesize, p.views, p.title, p.ID_MEMBER, m.real_name, p.date, p.description, p.totaldownloads
FROM {db_prefix}down_file as p
LEFT JOIN {db_prefix}members AS m ON (m.ID_MEMBER = p.ID_MEMBER)
$selectProJoin
WHERE p.approved = 1 ORDER BY p.totaldownloads DESC LIMIT $files";
break;
}
// Execute the SQL query
$dbresult = $smcFunc['db_query']('', $query);
$rowlevel = 0;
while($row = $smcFunc['db_fetch_assoc']($dbresult))
{
if ($rowlevel == 0)
echo '<tr class="windowbg2">';
echo '<td align="center"><a href="' . $scripturl . '?action=downloads;sa=view;id=' . $row['ID_FILE'] . '">',$row['title'],'</a><br />';
if ($isPro == true && $modSettings['down_set_t_image'] && !empty($row['thumbfilename']))
echo '<a href="' . $scripturl . '?action=downloads;sa=view;id=' . $row['ID_FILE'] . '"><img src="',$modSettings['down_url'],$row['thumbfilename'],'" alt="" /></a><br />';
echo '<span class="smalltext">';
//if (!empty($modSettings['down_set_t_rating']))
//echo $txt['downloads_form_rating'] . EzGetStarsByPrecent(($row['totalratings'] != 0) ? ($row['rating'] / ($row['totalratings']* 5) * 100) : 0) . '<br />';
if (!empty($modSettings['down_set_t_downloads']))
echo $txt['downloads_text_downloads'] . $row['totaldownloads'] . '<br />';
if (!empty($modSettings['down_set_t_views']))
echo $txt['downloads_text_views'] . $row['views'] . '<br />';
if (!empty($modSettings['down_set_t_filesize']))
echo $txt['downloads_text_filesize'] . round($row['filesize'] / 1024, 2) . 'KB<br />';
if (!empty($modSettings['down_set_t_date']))
echo $txt['downloads_text_date'] . timeformat($row['date']) . '<br />';
if (!empty($modSettings['down_set_t_comment']))
echo $txt['downloads_text_comments'] . ' (<a href="' . $scripturl . '?action=downloads;sa=view;id=' . $row['ID_FILE'] . '">' . $row['commenttotal'] . '</a>)<br />';
if (!empty($modSettings['down_set_t_username']))
{
if ($row['real_name'] != '')
echo $txt['downloads_text_by'] . ' <a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['real_name'] . '</a><br />';
else
echo $txt['downloads_text_by'] . ' ' . $txt['downloads_guest'] . '<br />';
}
echo '</span></td>';
if ($rowlevel < ($maxrowlevel-1))
$rowlevel++;
else
{
echo '</tr>';
$rowlevel = 0;
}
}
if ($rowlevel !=0)
{
echo '</tr>';
}
echo '
</table><br />';
}
Logged
shaka
Downloads Pro Customer
Newbie
Offline
Posts: 20
Re: Latest Downloads Block for Tiny Portal
«
Reply #8 on:
January 24, 2012, 06:40:53 pm »
wow almost perfect
is it possible only to show the image, title and members name
can I alter how many it shows i.e. latest 50 downloads
as it is for a center block is it possible to have them horizontal and vertical say 4 across and 12 down
thanks so much for taking the time
Logged
SMFHacks
Administrator
Hero Member
Offline
Posts: 9680
Re: Latest Downloads Block for Tiny Portal
«
Reply #9 on:
January 24, 2012, 06:46:25 pm »
Retry this code
Code:
//Example call
DownloadsBlock(4,50,'recent');
function DownloadsBlock($rows = 4, $files = 4, $type = 'recent')
{
global $txt, $smcFunc, $scripturl, $modSettings, $scripturl, $boardurl;
$rows = (int) $rows;
$files = (int) $files;
$isPro = true;
// Load the language files
if (loadlanguage('Downloads') == false)
loadLanguage('Downloads','english');
if (empty($modSettings['down_url']))
$modSettings['down_url'] = $boardurl . '/downloads/';
$maxrowlevel = $rows;
echo '<table cellspacing="0" cellpadding="5" border="0" align="center" width="100%">
';
//Check what type it is
$selectPro = '';
$selectProJoin = '';
if ($isPro == true)
{
$selectPro = " f.ID_PICTURE, f.thumbfilename, ";
$selectProJoin = " LEFT JOIN {db_prefix}down_file_pic AS f ON (f.ID_PICTURE = p.ID_PICTURE) ";
}
$query = ' ';
switch($type)
{
case 'recent':
$query = "SELECT p.ID_FILE, p.commenttotal, $selectPro p.totalratings, p.rating, p.filesize, p.views, p.title, p.ID_MEMBER, m.real_name, p.date, p.description, p.totaldownloads
FROM {db_prefix}down_file as p
LEFT JOIN {db_prefix}members AS m ON (m.ID_MEMBER = p.ID_MEMBER)
$selectProJoin
WHERE p.approved = 1 ORDER BY p.ID_FILE DESC LIMIT $files";
break;
case 'viewed':
$query = "SELECT p.ID_FILE, p.commenttotal, $selectPro p.totalratings, p.rating, p.filesize, p.views, p.title, p.ID_MEMBER, m.real_name, p.date, p.description, p.totaldownloads
FROM {db_prefix}down_file as p
LEFT JOIN {db_prefix}members AS m ON (m.ID_MEMBER = p.ID_MEMBER)
$selectProJoin
WHERE p.approved = 1 ORDER BY p.views DESC LIMIT $files";
break;
case 'mostcomments':
$query = "SELECT p.ID_FILE, p.commenttotal, $selectPro p.totalratings, p.rating, p.filesize, p.views, p.title, p.ID_MEMBER, m.real_name, p.date, p.description, p.totaldownloads
FROM {db_prefix}down_file as p
LEFT JOIN {db_prefix}members AS m ON (m.ID_MEMBER = p.ID_MEMBER)
$selectProJoin
WHERE p.approved = 1 ORDER BY p.commenttotal DESC LIMIT $files";
break;
case 'toprated':
$query = "SELECT p.ID_FILE, (p.rating / p.totalratings ) AS ratingaverage, p.commenttotal, $selectPro p.totalratings, p.rating, p.filesize, p.views, p.title, p.ID_MEMBER, m.real_name, p.date, p.description, p.totaldownloads
FROM {db_prefix}down_file as p
LEFT JOIN {db_prefix}members AS m ON (m.ID_MEMBER = p.ID_MEMBER)
$selectProJoin
WHERE p.approved = 1 ORDER BY ratingaverage DESC LIMIT $files ";
break;
case 'downloads':
$query = "SELECT p.ID_FILE, p.commenttotal, $selectPro p.totalratings, p.rating, p.filesize, p.views, p.title, p.ID_MEMBER, m.real_name, p.date, p.description, p.totaldownloads
FROM {db_prefix}down_file as p
LEFT JOIN {db_prefix}members AS m ON (m.ID_MEMBER = p.ID_MEMBER)
$selectProJoin
WHERE p.approved = 1 ORDER BY p.totaldownloads DESC LIMIT $files";
break;
}
// Execute the SQL query
$dbresult = $smcFunc['db_query']('', $query);
$rowlevel = 0;
while($row = $smcFunc['db_fetch_assoc']($dbresult))
{
if ($rowlevel == 0)
echo '<tr class="windowbg2">';
echo '<td align="center"><a href="' . $scripturl . '?action=downloads;sa=view;id=' . $row['ID_FILE'] . '">',$row['title'],'</a><br />';
if ($isPro == true && $modSettings['down_set_t_image'] && !empty($row['thumbfilename']))
echo '<a href="' . $scripturl . '?action=downloads;sa=view;id=' . $row['ID_FILE'] . '"><img src="',$modSettings['down_url'],$row['thumbfilename'],'" alt="" /></a><br />';
echo '<span class="smalltext">';
//if (!empty($modSettings['down_set_t_rating']))
//echo $txt['downloads_form_rating'] . EzGetStarsByPrecent(($row['totalratings'] != 0) ? ($row['rating'] / ($row['totalratings']* 5) * 100) : 0) . '<br />';
if (!empty($modSettings['down_set_t_username']))
{
if ($row['real_name'] != '')
echo $txt['downloads_text_by'] . ' <a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['real_name'] . '</a><br />';
else
echo $txt['downloads_text_by'] . ' ' . $txt['downloads_guest'] . '<br />';
}
echo '</span></td>';
if ($rowlevel < ($maxrowlevel-1))
$rowlevel++;
else
{
echo '</tr>';
$rowlevel = 0;
}
}
if ($rowlevel !=0)
{
echo '</tr>';
}
echo '
</table><br />';
}
Logged
shaka
Downloads Pro Customer
Newbie
Offline
Posts: 20
Re: Latest Downloads Block for Tiny Portal
«
Reply #10 on:
January 24, 2012, 06:49:25 pm »
wow that is perfect, thank you so much
Logged
Pages:
[
1
]
« previous
next »
Jump to:
Please select a destination:
-----------------------------
SMFHacks.com
-----------------------------
=> News
=> Site Discussion
===> Suggestions
===> Bugs
-----------------------------
SMF Gallery Pro
-----------------------------
=> Announcements
=> Presales
=> Support
===> Bugs
===> Feature Requests
-----------------------------
SMF Store
-----------------------------
=> Announcements
=> Presales
=> Support
===> Guides and Tips
===> Feature Requests
===> Bugs
-----------------------------
SMF Classifieds
-----------------------------
=> Announcements
=> Presales
=> Support
===> Bugs
===> Feature Requests
-----------------------------
Downloads System Pro
-----------------------------
=> Announcements
=> Presales
=> Support
===> Feature Requests
===> Bugs
-----------------------------
Ad Seller Pro
-----------------------------
=> Presales
=> Support
-----------------------------
Newsletter Pro
-----------------------------
=> Presales
=> Support
===> Feature Requests
-----------------------------
Social Login Pro
-----------------------------
=> Presales
-----------------------------
Badge Awards
-----------------------------
=> Presales
-----------------------------
Tweet Topics/FB Post System
-----------------------------
=> Presales
-----------------------------
SMF Gallery Lite
-----------------------------
=> SMF Gallery Lite
-----------------------------
Modifications/Themes
-----------------------------
=> General SMF Forum
=> Modifications Talk
===> Latest Mods
===> Modification Showcase
=> Theme Talk
===> Theme Showcase
===> Latest Themes
Recent
$txt['downloads_txt_day_l...
by
ApplianceJunk
[
Today
at 10:52:25 am]
Receiving eChecks?
by
ApplianceJunk
[
Today
at 10:35:29 am]
Feature Request: Ban indi...
by
ApplianceJunk
[May 24, 2012, 08:02:50 am]
Custom Fields
by
davejo
[May 24, 2012, 04:11:41 am]
Store IPN AMOUNT CHANGE
by
ApplianceJunk
[May 21, 2012, 08:54:11 am]
Transferring Db data from...
by
~ Phåråoh ~
[May 20, 2012, 11:06:52 am]
SMF vs PhpBB
by
channgam
[May 20, 2012, 05:58:11 am]
Any news?
by
SMFHacks
[May 19, 2012, 06:16:58 pm]
Social Login Pro domain c...
by
SMFHacks
[May 19, 2012, 05:42:37 pm]
licence information and q...
by
SMFHacks
[May 18, 2012, 03:08:38 pm]
Random Picture
Donate to SMFHacks.com
Help Support the SMFHacks.com mod making.
Loading...