neverstop
01-23-2008, 02:05 AM
Hi,
I have uploaded one of my cmps modules as a dyna module. When the module is enabled on browsecategory.php there is a problem with the catid variable. When trying to sort the url is missing the cat id (there should be a number after "video- "):
domain.com/dyna/video-/?orderby=title&direction=ASC
Also the breadcrumb does not show the last crumb (??). For example when browsing this forum "Troubleshooting & Problems" would not be there, just a blank space.
Here is the code for the module:
<?php
// ++=========================================================================++
// The order you would like to pull the links in.
// Enter 1 for newest, 2 for most viewed, 3 for most comments, 4 for highest rated, 5 for random
$order = 1;
// Enter the number of links you would like to display here
$limit = 25;
// Maximum characters of the links name before the rest will be replaced with '...'
// Set this to 0 to disable it.
$maxnamechars = 0;
// No further editing necessary
switch($order)
{
case 2:
$orderby = 'views DESC';
break;
case 3:
$orderby = 'posts DESC';
break;
case 4:
$votequery = 'IF(votenum >= 0, votenum, 0) AS votenum, IF(votenum >= 0 AND votenum > 0, votetotal / votenum, 0) AS voteavg,';
$orderby = 'voteavg DESC, votenum DESC';
break;
case 5:
$orderby = 'rand() DESC';
break;
default:
$orderby = 'dateline DESC';
}
// Get private directories
if ($catinfo = unserialize($datastore['links_d_cache']))
{
$privcatids = array();
foreach ($catinfo as $cats)
{
if ($cats['private'])
{
$privcatids[] = $cats['catid'];
}
}
$privcats = 'AND links.catid NOT IN (' . implode(',', $privcatids) . ')';
}
$getlinks = $vbulletin->db->query("
SELECT $votequery links.*, links_categories.description AS catdesc, cfields.*, links_categories.title
FROM " . TABLE_PREFIX . "adv_links AS links
LEFT JOIN " . TABLE_PREFIX . "adv_links_categories AS links_categories ON (links.catid = links_categories.catid)
LEFT JOIN " . TABLE_PREFIX . "adv_links_cfields_entries AS cfields ON (links.linkid = cfields.lid)
WHERE links.valid = 1 AND links.suspended = 0
ORDER BY $orderby
LIMIT $limit
");
require_once(DIR . '/includes/class_bbcode.php');
while ($link = $vbulletin->db->fetch_array($getlinks))
{
$link['catname'] = stripslashes($link['title']);
$link['catdesc'] = stripslashes($link['catdesc']);
$link['name'] = fetch_trimmed_title(stripslashes($link['name']), $maxnamechars);
$link['username'] = stripslashes($link['username']);
$link['date'] = vbdate($vbulletin->options['dateformat'], $link['dateline'], true);
$link['time'] = vbdate($vbulletin->options['timeformat'], $link['dateline'], true);
$link['posts'] = number_format($link['posts']);
$link['replies'] = number_format($link['replies']);
$link[votenum] = number_format($link['votenum']);
$link['truerating'] = $link['votenum'] ? vb_number_format($link['votetotal'] / $link['votenum'], 2) : 0;
$link['roundrating'] = round($link['truerating']);
$parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list());
$link['description'] = $parser->do_parse($link['description'], false, true, true, true, false, false);
$getbgrow = exec_switch_bg();
eval('$linkbits .= "' . fetch_template('adv_portal_linkbits') . '";');
}
$collapseobj_latestlinks = $vbcollapse['collapseobj_latestlinks'];
$collapseimg_latestlinks = $vbcollapse['collapseimg_latestlinks'];
eval('$home[$mods[\'modid\']][\'content\'] = "' . fetch_template('adv_portal_latestlinks') . '";');
?>
Cheers,
Ian
I have uploaded one of my cmps modules as a dyna module. When the module is enabled on browsecategory.php there is a problem with the catid variable. When trying to sort the url is missing the cat id (there should be a number after "video- "):
domain.com/dyna/video-/?orderby=title&direction=ASC
Also the breadcrumb does not show the last crumb (??). For example when browsing this forum "Troubleshooting & Problems" would not be there, just a blank space.
Here is the code for the module:
<?php
// ++=========================================================================++
// The order you would like to pull the links in.
// Enter 1 for newest, 2 for most viewed, 3 for most comments, 4 for highest rated, 5 for random
$order = 1;
// Enter the number of links you would like to display here
$limit = 25;
// Maximum characters of the links name before the rest will be replaced with '...'
// Set this to 0 to disable it.
$maxnamechars = 0;
// No further editing necessary
switch($order)
{
case 2:
$orderby = 'views DESC';
break;
case 3:
$orderby = 'posts DESC';
break;
case 4:
$votequery = 'IF(votenum >= 0, votenum, 0) AS votenum, IF(votenum >= 0 AND votenum > 0, votetotal / votenum, 0) AS voteavg,';
$orderby = 'voteavg DESC, votenum DESC';
break;
case 5:
$orderby = 'rand() DESC';
break;
default:
$orderby = 'dateline DESC';
}
// Get private directories
if ($catinfo = unserialize($datastore['links_d_cache']))
{
$privcatids = array();
foreach ($catinfo as $cats)
{
if ($cats['private'])
{
$privcatids[] = $cats['catid'];
}
}
$privcats = 'AND links.catid NOT IN (' . implode(',', $privcatids) . ')';
}
$getlinks = $vbulletin->db->query("
SELECT $votequery links.*, links_categories.description AS catdesc, cfields.*, links_categories.title
FROM " . TABLE_PREFIX . "adv_links AS links
LEFT JOIN " . TABLE_PREFIX . "adv_links_categories AS links_categories ON (links.catid = links_categories.catid)
LEFT JOIN " . TABLE_PREFIX . "adv_links_cfields_entries AS cfields ON (links.linkid = cfields.lid)
WHERE links.valid = 1 AND links.suspended = 0
ORDER BY $orderby
LIMIT $limit
");
require_once(DIR . '/includes/class_bbcode.php');
while ($link = $vbulletin->db->fetch_array($getlinks))
{
$link['catname'] = stripslashes($link['title']);
$link['catdesc'] = stripslashes($link['catdesc']);
$link['name'] = fetch_trimmed_title(stripslashes($link['name']), $maxnamechars);
$link['username'] = stripslashes($link['username']);
$link['date'] = vbdate($vbulletin->options['dateformat'], $link['dateline'], true);
$link['time'] = vbdate($vbulletin->options['timeformat'], $link['dateline'], true);
$link['posts'] = number_format($link['posts']);
$link['replies'] = number_format($link['replies']);
$link[votenum] = number_format($link['votenum']);
$link['truerating'] = $link['votenum'] ? vb_number_format($link['votetotal'] / $link['votenum'], 2) : 0;
$link['roundrating'] = round($link['truerating']);
$parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list());
$link['description'] = $parser->do_parse($link['description'], false, true, true, true, false, false);
$getbgrow = exec_switch_bg();
eval('$linkbits .= "' . fetch_template('adv_portal_linkbits') . '";');
}
$collapseobj_latestlinks = $vbcollapse['collapseobj_latestlinks'];
$collapseimg_latestlinks = $vbcollapse['collapseimg_latestlinks'];
eval('$home[$mods[\'modid\']][\'content\'] = "' . fetch_template('adv_portal_latestlinks') . '";');
?>
Cheers,
Ian