Quote:
Originally Posted by BirdOPrey5
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
cni.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.
|
Thanks Joe..

But its throwing a Database error, something to do with the cni.publishdate I think
Code:
Database error in vBulletin 4.1.12:
Invalid SQL:
SELECT DISTINCT
ca.contentid,
cn.publishdate,
cn.nodeid,
cni.title,
cni.viewcount
FROM
cms_nodecategory cnc
JOIN
cms_node cn
ON
cnc.nodeid = cn.nodeid
JOIN
cms_article ca
ON
cn.contentid = ca.contentid
JOIN
cms_nodeinfo cni
ON
cn.nodeid = cni.nodeid
WHERE
cn.parentnode = 4
ORDER BY
cni.publishdate desc
LIMIT 5;
MySQL Error : Unknown column 'cni.publishdate' in 'order clause'
Error Number : 1054
Request Date : Thursday, May 17th 2012 @ 07:31:24 PM
Error Date : Thursday, May 17th 2012 @ 07:31:25 PM
Script : http://tomorrowsgaming.com/
Referrer : http://tomorrowsgaming.com/
IP Address : 122.61.154.171
Username : xxxxx
Classname : vB_Database
MySQL Version : 5.1.61-cll