The Arcive of vBulletin Modifications Site. |
|
Widget: CMS Most Viewed Articles This Week Details »»
|
|||||||||||||||||||||||||||||
|
Widget: CMS Most Viewed Articles This Week
Developer Last Online: Jan 2012
Most Viewed Articles This Week 1. Installation 1. Goto Admincp->vBullietin CMS->Widgets->Create New Widget 2. Choose PHP Direct Execution as Widget's Type 3. Insert a title. This Week's Most Popular for example. 4. Click Save 5. Click Configure on the right of the newly created widget. 6. Remove the default code that appears. 7. Copy and Paste the code in item 2 below. 8. Save 9. Goto Admincp->vBullietin CMS->Layout Manager 10. Add the Widget to your Layout 11. Click Save 2. PHP Code Code:
// Current Week Most Viewed
$starttime = time() - (3600*24*7);
$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.setpublish = 1
AND
cn.publishdate>'".$starttime."'
ORDER BY
cni.viewcount desc
LIMIT 5
");
$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>';
}
3. Change Log [Version 1.02 9-23-2010] Removed unnecessary ob*() calls. Changed output_bits to just output. [Version 1.01 4-21-2010] Fixed a bug show the correct URL was used for each article. Screenshots
Show Your Support
|
|||||||||||||||||||||||||||||
| Благодарность от: | ||
| romaszek | ||
| Comments |
|
#2
|
|||
|
|||
|
Please one screenshot or demo....?
|
|
#3
|
|||
|
|||
|
PHP Code updated and screen shot attached.
|
|
#4
|
|||
|
|||
|
When does it get populated with the names of the Articles? I have installed and carried out the instructions above, but the 'This Week's Most Popular Article Box is empty!
Thanks |
|
#5
|
|||
|
|||
|
Same for me. Empty
|
|
#6
|
|||
|
|||
|
Same for me
|
|
#7
|
|||
|
|||
|
Code:
ob_start();
// Current Week Most Viewed
$starttime = time() - (3600*24*7);
$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.setpublish = 1
AND
cn.publishdate>'".$starttime."'
ORDER BY
cni.viewcount desc LIMIT 5
");
$output_bits = '';
while($article = vB::$db->fetch_array($mostpopularweek_get))
{
$output_bits .='<div class = "cms_widget_post_bit"><h4 class = "cms_widget_post_header">
<a href="content.php?r='.$article[nodeid].'">'.$article[title].'</a></h4></div>';
}
$output = $output_bits;
ob_end_clean();
|
|
#8
|
|||
|
|||
|
Quote:
Parse error: syntax error, unexpected T_STRING in /home2/rwfforum/public_html/vBulletin/packages/vbcms/widget/execphp.php(177) : eval()'d code on line 43 |
|
#9
|
|||
|
|||
|
can you post your code for me?
|
|
#10
|
|||
|
|||
|
It is working now, using the new code. Thanks
|
![]() |
|
|