Page 1 of 1

Center Downloads Block

PostPosted: Sun Mar 25, 2007 7:57 am
Author: Khimaira
I am using the Center Downloads Block that shows Top and New downloads. Is it possible for it to also show which category the download is from?

Re: Center Downloads Block

PostPosted: Mon Mar 26, 2007 7:36 am
Author: Frost
I'm looking into this for you <img>

Re: Center Downloads Block

PostPosted: Mon Mar 26, 2007 6:12 pm
Author: Helter
ive almost got this working, but im having trouble. No matter what syntax I use, I cannot get it to querry the pa_cat table. Can anyone show me the proper edit to this
Code: Select all
          $sql = "SELECT * FROM " . $table_prefix."pa_files ORDER BY file_dls DESC LIMIT 0," . $portal_config['md_num_top_downloads'];           if ( !($result = $db->sql_query($sql)) )



here is the full block

Code: Select all
 <php> 'category');                          if(!function_exists(imp_center_downloads2_block_func)){     function imp_center_downloads2_block_func()     {         global $template, $portal_config, $table_prefix, $phpEx, $db, $lang, $board_config, $theme;           $sql = "SELECT * FROM " . $table_prefix."pa_files ORDER BY file_dls DESC LIMIT 0," . $portal_config['md_num_top_downloads'];           if ( !($result = $db->sql_query($sql)) )         {             message_die(GENERAL_ERROR, 'Could not query database for the most downloads');         }           $i = 1;         while ($file_most = $db->sql_fetchrow($result))         {               $row_class = ( !($i % 2) ) ? 'row1'],                 'FILECATNAME_MOST' => $file_most['cat_name'],                 'ROW_CLASS' => $row_class,                 'FILELINK_MOST' => append_sid("dload." . $phpEx . "?action=file&file_id=" . $file_most['file_id']),                 'FILENAME_MOST' => $file_most['file_name'],                 'DESCRIP_MOST' => $file_most['file_desc'],                 'INFO_MOST' => $file_most['file_dls'] . ' ' . $lang['Dls'])             );                             $i++;         }           $sql = "SELECT * FROM " . $table_prefix."pa_files ORDER BY file_time DESC LIMIT 0," . $portal_config['md_num_new_downloads'];           if ( !($result = $db->sql_query($sql)) )         {             message_die(GENERAL_ERROR, 'Could not query database for the most downloads');         }           $i = 1;         while ($file_latest = $db->sql_fetchrow($result))         {               $row_class = ( !($i % 2) ) ? 'row1': 'row2';             $template->assign_block_vars('dlrow2', array(                 'NUMBER_LATEST' => strval($i),                 'FILECATID_LATEST' => $file_latest['file_catid'],                 'FILECATNAME_LATEST' => $file_latest['cat_name'],                 'FILELINK_LATEST' => append_sid("dload." . $phpEx . "?action=file&file_id=" . $file_latest['file_id']),                 'ROW_CLASS' => $row_class,                 'FILENAME_LATEST' => $file_latest['file_name'],                 'DESCRIP_LATEST' => $file_latest['file_desc'],                 'INFO_LATEST' => create_date($board_config['default_dateformat'], $file_latest['file_time'], $board_config['board_timezone']))             );                             $i++;         }           $template->assign_vars(array(             'FILE_CATAGORY' => $lang['File_catagory'],             'TOP_DOWNLOADS' => $lang['Top_downloads'],             'NEW_DOWNLOADS' => $lang['New_downloads']             )         );     }}  imp_center_downloads2_block_func();?>  


you can see what ive got so far at the bottom of this page http://www.duiplayground.com/forum/portal.php

Re: Center Downloads Block

PostPosted: Tue Mar 27, 2007 5:13 am
Author: Frost
Hmm, if I had the tpl file and cfg (if exists) i could do a trial and error but maybe try this?

Code: Select all
<php>sql_query($sql)) )         {             message_die(GENERAL_ERROR, 'Could not query database for the most downloads');         }           $i = 1;         while ($file_most = $db->sql_fetchrow($result))         {               $row_class = ( !($i % 2) ) ? 'row1'],                 'FILECATNAME_MOST' => $file_most['cat_name'],                 'ROW_CLASS' => $row_class,                 'FILELINK_MOST' => append_sid("dload." . $phpEx . "?action=file&file_id=" . $file_most['file_id']),                 'FILENAME_MOST' => $file_most['file_name'],                 'DESCRIP_MOST' => $file_most['file_desc'],                 'INFO_MOST' => $file_most['file_dls'] . ' ' . $lang['Dls'])             );                             $i++;         }           $sql = "SELECT * FROM " . $table_prefix."pa_files ORDER BY file_time DESC LIMIT 0," . $portal_config['md_num_new_downloads'];           if ( !($result = $db->sql_query($sql)) )         {             message_die(GENERAL_ERROR, 'Could not query database for the most downloads');         }           $i = 1;         while ($file_latest = $db->sql_fetchrow($result))         {               $row_class = ( !($i % 2) ) ? 'row1': 'row2';             $template->assign_block_vars('dlrow2', array(                 'NUMBER_LATEST' => strval($i),                 'FILECATID_LATEST' => $file_latest['file_catid'],                 'FILECATNAME_LATEST' => $file_latest['cat_name'],                 'FILELINK_LATEST' => append_sid("dload." . $phpEx . "?action=file&file_id=" . $file_latest['file_id']),                 'ROW_CLASS' => $row_class,                 'FILENAME_LATEST' => $file_latest['file_name'],                 'DESCRIP_LATEST' => $file_latest['file_desc'],                 'INFO_LATEST' => create_date($board_config['default_dateformat'], $file_latest['file_time'], $board_config['board_timezone']))             );                             $i++;         }           $template->assign_vars(array(             'FILE_CATAGORY' => $lang['File_catagory'],             'TOP_DOWNLOADS' => $lang['Top_downloads'],             'NEW_DOWNLOADS' => $lang['New_downloads']             )         );     }}  imp_center_downloads2_block_func();?>


Note: Removed
Code: Select all
'category');
as I did not know what it was for, and tried testing, without luck for lack of tpl/cfg

Also, looks like you're almost there, I thought I saw some cat id #s <img>

Re: Center Downloads Block

PostPosted: Fri Apr 06, 2007 10:34 am
Author: Frost
I just looked back at your site Helter, almost there lol

I asked some guys at phpbbmodders but no reply, that seems to be a popular thing over there <img>