![]() |
Widget: CMS Most Viewed Articles This Week
1 Attachment(s)
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 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. |
Please one screenshot or demo....?
|
PHP Code updated and screen shot attached.
|
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 |
Same for me. Empty
|
Same for me
|
Code:
ob_start(); |
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 |
can you post your code for me?
|
Quote:
|
Not for me.
This is the code I've inserted: 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(); |
Any chance to make this work for a forum block ?
Cheers |
it works,thanks. How can be done by daily?
|
g10net,
You could just change the $starttime to: PHP Code:
|
Installed, Working 100%, Thanks :)
|
can u make a XML? i mean installation file
|
Quote:
|
Make sure that the starttime line looks just like the above post. Alternatively you can use:
PHP Code:
|
Quote:
|
Installed on 4.0.4pl1 and works fine ... :)
Thanks ... Regards, Badger |
I'm on 4.0.2, doesn't work.
|
Perhaps there's something else interfering?
Regards, Badger |
Doesn't work on 4.04, only displays:
%24-%b-%2010 |
comes up blank on 4.0.5
|
Second that it comes up blank on 4.0.5
|
I changed the code and now it's working for me
Code:
ob_start(); |
Quote:
Regards, Badger |
My fault
try this Code:
ob_start(); |
Nope, that doesn't work either ... thanks anyway...
Quote:
|
let me fix for you again.....
Code:
ob_start(); |
Quote:
Does it need to run for a while to generate history before it displays anything? Thanks .. :) Regards, Badger |
BadgerDog this will display the content of your articles from last 7 days in order of biggest page views number to less pageviews... if you dont have any article published in last 7 days this will return nothing... So my suggestion to you is publish a new article and see if this new article will appear on this widget.
Let me know if worked for you :) |
Ok, sorry, I misunderstood what it did ...
I thought it displayed "Most Viewed Articles This Week", meaning which of the several thousand articles we already have in our research library have been the most viewed by members this week. I guess I'll have to un-install this as it's always going to be blank ... :) Thanks for your efforts ... Regards, Badger |
Installed on 4.0.7 and working great!
Is there any way to make it pull articles from a specific section? |
Where can I exchange the name of the widget? (I want to use another one than "5 Most viewed Article" )
|
Quote:
|
how can i set this to be most viewed articles ever (not 7 days)
|
Quote:
(3600*24*7) by (3600*24*18250) I don't think your forum is older than 50 year lol. |
Any way to include thumbnail images with this
|
1 Attachment(s)
This code works in 4.1.0
Code:
ob_start(); |
All times are GMT. The time now is 07:13 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|