Quote:
Originally Posted by The Rocketeer
any ideas on getting it to pull x number of articles from a specific category instead of view count?
|
I don't know about category but if you check the database you can see the column for
parentnode in the
cms_node table. On my site the parentnode seems to be numerical number consistent with a category...
Then change the PHP code to:
Code:
$mostpopularweek_get = vB::$db->query_read("
SELECT DISTINCT
ca.contentid,
cn.publishdate,
cn.nodeid,
cni.title,
cni.viewcount
FROM
".TABLE_PREFIX."cms_nodecategory cnc
JOIN
".TABLE_PREFIX."cms_node cn
ON
cnc.nodeid = cn.nodeid
JOIN
".TABLE_PREFIX."cms_article ca
ON
cn.contentid = ca.contentid
JOIN
".TABLE_PREFIX."cms_nodeinfo cni
ON
cn.nodeid = cni.nodeid
WHERE
cn.parentnode = X
ORDER BY
cn.publishdate desc
LIMIT Y
");
$output = '';
while($article = vB::$db->fetch_array($mostpopularweek_get))
{
$output .='<div class = "cms_widget_post_bit"><h4 class="cms_widget_post_header"><a href="content.php?r='.$article[nodeid].'">'.$article[title].'</a> </h4></div>';
}
Look at the 2 lines in red-
X = the parentnode you want (this will be a number)
Y = The max number of articles you want to pull from that parentnome (also a number.)
That *should* work, I haven't tested it at all but it is basic MySQL. I didn't change any of the php code.