Hey people!
I've recently returned to Tiny Portal from MKPortal,
because Tiny Portal is a better support and addition to SMF.
Anyway,
now I am stuck with a question.
Does there already exist a block which can show the latest uploaded downloads (or something similar) from the SMF Download hack?
I've been searching around on the forums with no result,
it seems that the search doesn't filter it out.
http://custom.simplemachines.org/mods/index.php?mod=992
-> Download system.
With a friendly greet and thanks in advance ;),
Heero
I don't think it exists.
What do you want?
OK here is a shot in the dark, I haven't tested this but give it a try
<See later posts>
Thank you for the replies
JPDeni,
I'd like to have a simular 'latest downloads' block as like the one from Tiny Portal.
Hey Dragooon,
thanks for your quick reply but you're shot in the dark didn't worked ;)
It makes the full page 'blank'.
Any further assistence is welcome :)
Thanks in advance,
~- Heero
Heero, can I get your example of what you want it to look like and what you want it to include? That way we'll both know that we're on the same page.
Can you tell me if any errors are there in error log?
Seems like the DB query is messed up.
Well of course.
Just something similar then the block :
tpmodule:
Downloads show x New Files.
Example : http://img517.imageshack.us/my.php?image=downloadsct4.jpg
Dragooon,
It gives the following error :
Table 'databaseName_smf.smf_down_files' doesn't exist
File: /home/xxx/domains/domain.org/public_html/smf/Sources/Load.php(1770) : eval()'d code(209) : eval()'d code
Line: 9
Thanks for the support again.
OK try this
<See later posts>
With some modifications it can be made like that, I'll do that tomorrow :)
Great, it works!
Thank You Dragooon,
also thanks for your support JPDeni.
And yeah it might be adjusted a bit, but I'm glad it works :).
Glad it worked, I'll post the code to make it look like TP's recent downloads block tomorrow.(Unless someone else does it :))
oops
Use the fol. code
global $db_prefix, $scripturl;
$request = db_query("SELECT f.ID_FILE, f.ID_MEMBER, f.date, f.ID_CAT, f.title AS ftitle,
c.title, m.realName, m.ID_MEMBER AS mID_MEMBER
FROM {$db_prefix}down_file AS f, {$db_prefix}down_cat AS c, {$db_prefix}members AS m
WHERE f.ID_CAT = c.ID_CAT
AND f.approved = '1'
AND f.ID_MEMBER = m.ID_MEMBER
ORDER BY f.ID_FILE DESC
LIMIT 5",__FILE__,__LINE__);
while($row = mysql_fetch_assoc($request)) {
echo '<div style="margin:5px"><a href="',$scripturl,'?action=view;id=',$row['ID_FILE'],'">',$row['ftitle'],'</a> by <a href="',$scripturl,'?action=profile;u=',$row['mID_MEMBER'],'">',$row['realName'],'</a> in <a href="',$scripturl,'?action=viewc;id=',$row['ID_CAT'],'">',$row['title'],'</a></div>';
}
The previous ones didn't had a "limit" set to them so they would've shown all the uploads sent(I am sure you wouldn't want that :P)
glad you got it sorted. :)
Okay dude, thanks again!
hello,
In the picture , can't you that pretend?
(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Ffussilet.com%2Fdown.png&hash=5dc470e4886ff6c24aeb48b3bc0c272b262a0eaf)
I said I am gonna do that "tomorrow", so now is the tomorrow and here is the code:
global $db_prefix, $scripturl;
$request = db_query("SELECT f.ID_FILE, f.ID_MEMBER, f.date, f.ID_CAT, f.title AS ftitle, f.totaldownloads,
c.title, m.realName, m.ID_MEMBER AS mID_MEMBER
FROM {$db_prefix}down_file AS f, {$db_prefix}down_cat AS c, {$db_prefix}members AS m
WHERE f.ID_CAT = c.ID_CAT
AND f.approved = '1'
AND f.ID_MEMBER = m.ID_MEMBER
ORDER BY f.ID_FILE DESC
LIMIT 5",__FILE__,__LINE__);
while($row = mysql_fetch_assoc($request)) {
echo '<table width="100%" cellpadding="2" cellspacing="0">
<tr>
<td valign="top" class="smalltext"> <a href="',$scripturl,'?action=view;id=',$row['ID_FILE'],'">',$row['ftitle'],'</a></td>
<td valign="top" class="smalltext" align="right">',$row['totaldownloads'],'</td>
</tr>
</table>';
}
Now it *should* show like TP's Recent downloads block.
thank you very much, You are one piece :up
- :up + up: + : up : ==>≥ :up: :D (https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fdingo.care2.com%2Fc2c%2Femoticons%2Fthumbsup.gif&hash=fa297e44b9bf26c1d5cba514c6b7166ed5403a12)
thanks crip :up: ;)
U bet fussilet (https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fdingo.care2.com%2Fc2c%2Femoticons%2Fthumbsup.gif&hash=fa297e44b9bf26c1d5cba514c6b7166ed5403a12)
lol.....Glad it worked for you :D
It was just a *blind* shot, I don't even use that mod :P
Hmm yeah thanks dude!
You just fixed this up in two days :)
Although, I'd like to ask one little thing for it:
Could you fix the code,
so the block will only show the file(s) of a specific category?
Thanks in advance!
~- Heero
No problem, I love to help others and I love coding.
Use the fol. code
global $db_prefix, $scripturl;
$cats = array(1,2,3);
$request = db_query("SELECT f.ID_FILE, f.ID_MEMBER, f.date, f.ID_CAT, f.title AS ftitle, f.totaldownloads,
c.title, m.realName, m.ID_MEMBER AS mID_MEMBER
FROM {$db_prefix}down_file AS f, {$db_prefix}down_cat AS c, {$db_prefix}members AS m
WHERE f.ID_CAT = c.ID_CAT
AND f.approved = '1'
AND f.ID_MEMBER = m.ID_MEMBER
".!empty($cats) ? "AND f.ID_CAT IN('".implode(',',$cats)."')" : ''."
ORDER BY f.ID_FILE DESC
LIMIT 5",__FILE__,__LINE__);
while($row = mysql_fetch_assoc($request)) {
echo '<table width="100%" cellpadding="2" cellspacing="0">
<tr>
<td valign="top" class="smalltext"> <a href="',$scripturl,'?action=view;id=',$row['ID_FILE'],'">',$row['ftitle'],'</a></td>
<td valign="top" class="smalltext" align="right">',$row['totaldownloads'],'</td>
</tr>
</table>';
}
$cats is a array, containing IDs of cats to show from
If I wrote it right, it should show from every cat if left empty.
Seems like it casts an error :D
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND f.ID_CAT IN('1,2,3')' at line 1
File: /home/xxx/domains/domain.org/public_html/smf/Sources/Load.php(1770) : eval()'d code(209) : eval()'d code
Line: 11
And thanks again for your reply.
I really appreciate what you're doing here :)
Hmm
Try this one
global $db_prefix, $scripturl;
$cats = array(1,2,3);
$request = db_query("SELECT f.ID_FILE, f.ID_MEMBER, f.date, f.ID_CAT, f.title AS ftitle, f.totaldownloads,
c.title, m.realName, m.ID_MEMBER AS mID_MEMBER
FROM {$db_prefix}down_file AS f, {$db_prefix}down_cat AS c, {$db_prefix}members AS m
WHERE f.ID_CAT = c.ID_CAT
AND f.approved = '1'
AND f.ID_MEMBER = m.ID_MEMBER
".!empty($cats) ? "AND f.ID_CAT IN(".implode(',',$cats).")" : ''."
ORDER BY f.ID_FILE DESC
LIMIT 5",__FILE__,__LINE__);
while($row = mysql_fetch_assoc($request)) {
echo '<table width="100%" cellpadding="2" cellspacing="0">
<tr>
<td valign="top" class="smalltext"> <a href="',$scripturl,'?action=view;id=',$row['ID_FILE'],'">',$row['ftitle'],'</a></td>
<td valign="top" class="smalltext" align="right">',$row['totaldownloads'],'</td>
</tr>
</table>';
}
I think it was those damn single quotes causing trouble.
If it works, make sure you enter valid Category IDs
Damn sorry .. :/
It still doesn't works.
It returns the following error :
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND f.ID_CAT IN(1)' at line 1
File: /home/xxx/domains/domain.org/public_html/smf/Sources/Load.php(1770) : eval()'d code(209) : eval()'d code
Line: 11
damns,
Thanks again.
I corrected the council...
code :
Quote<a href="',$scripturl,'?action=view;id=',$row['ID_FILE'],'">',$row['ftitle'],'</a>
I exchanged
Quote<a href="',$scripturl,'?action=downloads;sa=view;id=',$row['ID_FILE'],'">',$row['ftitle'],'</a>
Can't seem to figure out what Is wrong, I'll see to it later :)
Now, There isn't the problem ;)
I wasn't talking about that, I was talking about showing from specific categories.
And can you remove the [color=red BBC tags since in Code block the other BBC doesn't works.
Well fussilet check what Dragooon said,
The code works, but showing specific categories fails somehow and returns an error O.o!
I removed the color red code, hope it helps
Thanks G6,
Yet it shouldn't be
<a href="',$scripturl,'?action=downloads;sa=view;id=',$row['ID_FILE'],'">',$row['ftitle'],'[/URL]
It should be
<a href="',$scripturl,'?action=downloads;sa=view;id=',$row['ID_FILE'],'">',$row['ftitle'],'</a>
[/URL] = </a>
Well hmm ..
It still doesn't work over here :/
Error :
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND f.ID_CAT IN(1)' at line 1
File: /home/xxx/domains/domain.org/public_html/smf/Sources/Load.php(1770) : eval()'d code(209) : eval()'d code
Line: 11
That has NOTHING to do with that problem......
I'll work on it later, currently I am out of time.
This should work
global $db_prefix, $scripturl;
$cats = array();
$cat = implode(',',$cats);
$categories = '';
if(!empty($cats))
$categories = "AND f.ID_CAT IN($cat)";
$request = db_query("SELECT f.ID_FILE, f.ID_MEMBER, f.date, f.ID_CAT, f.title AS ftitle, f.totaldownloads,
c.title, m.realName, m.ID_MEMBER AS mID_MEMBER
FROM {$db_prefix}down_file AS f, {$db_prefix}down_cat AS c, {$db_prefix}members AS m
WHERE f.ID_CAT = c.ID_CAT
AND f.approved = '1'
AND f.ID_MEMBER = m.ID_MEMBER
$categories
ORDER BY f.ID_FILE DESC
LIMIT 5",__FILE__,__LINE__);
while($row = mysql_fetch_assoc($request)) {
echo '<table width="100%" cellpadding="2" cellspacing="0">
<tr>
<td valign="top" class="smalltext"> <a href="',$scripturl,'?action=downloads;sa=view;id=',$row['ID_FILE'],'">',$row['ftitle'],'</a></td>
<td valign="top" class="smalltext" align="right">',$row['totaldownloads'],'</td>
</tr>
</table>';
}
Yeah it works!
Thanks Dragooon!
Glad it finally worked out :p
I think I should start testing my codes before posting :P
Quote from: Dragooon on March 13, 2008, 08:36:51 AM
Glad it finally worked out :p
I think I should start testing my codes before posting :P
What a novel idea... lol
You mean "nobel"?
lol Thanks :P
Nope.. I think he means >> "novel (http://www.thefreedictionary.com/novel)" << Adj. 2 :P
Quote from: ZTN on March 13, 2008, 04:03:51 PM
Nope.. I think he means >> "novel (http://www.thefreedictionary.com/novel)" << Adj. 2 :P
Ding! Thats 10 points for Zetan!
hi there.
this little snippet works well on my site, but is there a way to sort the downloads with "most popular" instead of "last uploaded"?
I think this is the line
ORDER BY f.ID_FILE DESC
so what do I have to change if I want to display the most popular downloads?
:)
EDIT:
Nevermind. got it by myself it's
ORDER BY f.totaldownloads DESC