Quote:
Originally Posted by mehrdad220
is there any way to add a CMPS latest added block which shows the latest added file from a specific category only??
|
No, that's not possible at the moment. Only the latest files of alle categories can be displayed. Although it's easy to make.
Module dl2categorylatest.php PHP code (change the $categoryid):
PHP Code:
require_once('./includes/class_downloads.php');
$dl = new vB_Downloads();
$categoryid = 5; // Set this yourself
$statslatestfiles_q = $db->query_read("SELECT name, id FROM " . TABLE_PREFIX . "dl_files WHERE `purgatory`= 0 AND category = $categoryid ORDER BY `date` DESC LIMIT " . $dl->statslatestfiles);
while ($latest = $db->fetch_array($statslatestfiles_q))
{
$name = htmlspecialchars_uni($latest['name']);
$id = $latest['id'];
$url = $vbulletin->options['bburl'] . '/downloads.php?' . $vbulletin->session->vars['sessionurl'] . "do=file&id=$id";
if ($id > 0)
{
eval('$dpanel_latest_bits .= "' . fetch_template('downloads_panel_bit') . '";');
}
}
$db->free_result($statslatestfiles_q);
eval('$home[$mods[\'modid\']][\'content\'] .= "' . fetch_template('adv_portal_dl2categorylatest') . '";');
adv_portal_dl2categorylatest template:
HTML Code:
<tr>
<td class="thead">Latest Files</td>
</tr>
<tr>
<td class="alt1">
<table cellpadding="2" cellspacing="$stylevar[cellspacing]" border="0" width="100%">
$dpanel_latest_bits
</table>
</td>
</tr>
(Installation goes the same as the default vBa CMPS add-on, except the above changes.