TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 317
  • Total: 317

upgraded to RC3 few blocks dont work..

Started by uniektekniek, June 09, 2010, 04:54:07 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

uniektekniek

after a bit of reading i see that this is a common issue.. i have a few scripts for phpblocks that were working a treat and I cant find any others that are quite the same.. so i was wondering if i could get one of you lovely people to have a look and see if you could update the scripts to work with RC3??

i have tried a fair few other blocks today in the hope i wouldnt have to both you all.. but i cant seem to get anything to work as well as these did so it would be very much appreciated if someone could have a play with them..



SMF Downloads, Newest Downloads

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=downloads;sa=view;id=',$row['ID_FILE'],'">',$row['ftitle'],'</a></td>
<td valign="top" class="smalltext" align="right">',$row['totaldownloads'],'</td>
</tr>
</table>';
}




SMF Downloads, Most Downloaded

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.totaldownloads 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>';
}




SMF Links, newest links

   global $db_prefix, $scripturl, $txt, $settings, $modSettings, $subcats_linktree;
   if (!empty($modSettings['smflinks_setshowtoprate']))
      {
         echo '<div class="tborder" style="margin: 2%;"><div class="catbg2">' . $txt['smflinks_topfiverated'] . '</div>';
         echo '<table>';

         $dbresult = db_query("SELECT l.ID_LINK, l.rating, l.title,l.date, m.realName, l.ID_MEMBER, l.description,l.hits FROM {$db_prefix}links AS l LEFT JOIN {$db_prefix}members AS m ON (l.ID_MEMBER = m.ID_MEMBER)  WHERE l.approved = 1 ORDER BY l.date DESC LIMIT 10", __FILE__, __LINE__);
         while($row = mysql_fetch_assoc($dbresult))
         {
            echo '<tr>
            <td>
            <a href="' . $scripturl . '?action=links;sa=visit;id=' . $row['ID_LINK'] . '" target="blank"><img src="' .$settings['tp_images_url']. '/TPdivider2.gif" alt="" />' . $row['title'] . '</a> ';
         
     
            echo $txt['smflinks_hits'] . $row['hits'];
           
            if ($editlink)
               echo ' <a href="' . $scripturl . '?action=links;sa=editlink;id=' . $row['ID_LINK'] . '">' . $txt['smflinks_txtedit'] . '</a> ';
            if ($deletelink)
               echo '<a href="' . $scripturl . '?action=links;sa=deletelink;id=' . $row['ID_LINK'] . '">' . $txt['smflinks_txtdel'] . '</a>';
   
            echo '</td></tr>';
         }
         echo '</table>';
         mysql_free_result($dbresult);
         echo '</div>';
      }

uniektekniek

for anyone else that might be using SMF downloads and SMF links on 1.1.11.. these scripts all work great in 1.1.11.. well worth a try..

IchBin

#2
Give this a try. Please try one at a time and report back if there are any errors. This assumes that your table and row names haven't changed in SMF2 for the download mod. If they have, you'll have to look at your database and change the names in the code to match what they are in the database.

global $db_prefix, $scripturl;

$request = tpdb_query("SELECT f.ID_FILE, f.ID_MEMBER, f.date, f.ID_CAT, f.title AS ftitle, f.totaldownloads,
c.title, m.real_name, 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 = tpdb_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>';
}
tpdb_free_result($request);




SMF Downloads, Most Downloaded

global $db_prefix, $scripturl;

$request = tpdb_query("SELECT f.ID_FILE, f.ID_MEMBER, f.date, f.ID_CAT, f.title AS ftitle, f.totaldownloads,
c.title, m.real_name, 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.totaldownloads DESC
LIMIT 5",__FILE__,__LINE__);
while($row = tpdb_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>';
}
tpdb_free_result($request);




SMF Links, newest links

global $db_prefix, $scripturl, $txt, $settings, $modSettings, $subcats_linktree;
if (!empty($modSettings['smflinks_setshowtoprate'])) {

     echo '
<div class="tborder" style="margin: 2%;">
<div class="catbg2">' . $txt['smflinks_topfiverated'] . '</div>
<table>';

     $dbresult = tpdb_query("SELECT l.ID_LINK, l.rating, l.title,l.date, m.real_name, l.ID_MEMBER, l.description,l.hits
FROM {$db_prefix}links AS l
LEFT JOIN {$db_prefix}members AS m ON (l.ID_MEMBER = m.id_member) 
WHERE l.approved = 1
ORDER BY l.date DESC LIMIT 10", __FILE__, __LINE__);
     while($row = tpdb_fetch_assoc($dbresult)) {
        echo '
<tr>
        <td>
        <a href="' . $scripturl . '?action=links;sa=visit;id=' . $row['ID_LINK'] . '" target="blank">
<img src="' .$settings['tp_images_url']. '/TPdivider2.gif" alt="" />' . $row['title'] . '
</a> ';
     
 
        echo $txt['smflinks_hits'] . $row['hits'];

if ($editlink)
   echo '
<a href="' . $scripturl . '?action=links;sa=editlink;id=' . $row['ID_LINK'] . '">' . $txt['smflinks_txtedit'] . '</a> ';
if ($deletelink)
   echo '
<a href="' . $scripturl . '?action=links;sa=deletelink;id=' . $row['ID_LINK'] . '">' . $txt['smflinks_txtdel'] . '</a>';

        echo '
</td>
</tr>';
     }
     echo '
</table>';
     tpdb_free_result($dbresult);
     echo '</div>';
}

uniektekniek

you sir, are a legend!

they all work perfectly... thank you very much for your help.. :)

IchBin

Wow, that's a first. lol I usually miss something. My coding chops must be getting sharper. :) Glad it worked!

Freddy

Well done Ich :)

I noticed you are using tpdb_query but I have been using tp_query and it works too.

Is there any difference do you know ?

IchBin

Originall Bloc created tp_query() to deal with the database changes. Later he decided to add the rest of the database functions and he used the prefix tpdb_ to keep things organized is all. At least from what I can tell. :) I'm pretty sure he'll keep both just for backwards compatability.

This website is proudly hosted on Crocweb Cloud Website Hosting.