The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
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 |
#42
|
|||
|
|||
this work great for vbulletin 4.1.1, thanks
Quote:
|
#43
|
||||
|
||||
Works on 4.1.4 THANX!
|
#44
|
|||
|
|||
Hey.
Why there are no separators ? Thanks. |
#45
|
||||
|
||||
not working on my 4.1.5.... sql errors
|
#46
|
|||
|
|||
It's not working on 4.1.6 .
This version of the code is working for me: https://vborg.vbsupport.ru/showpost....79&postcount=5 |
#47
|
|||
|
|||
it is possible to add image's article?
|
#48
|
|||
|
|||
I have this code:
ob_start(); // Current Week Most Viewed $mostpopularweekget = vB::$db->query_read(" select ".TABLE_PREFIX."cms_node.nodeid as nodeid, ".TABLE_PREFIX."cms_nodeinfo.title as title FROM ".TABLE_PREFIX."cms_node, ".TABLE_PREFIX."cms_nodeinfo where ".TABLE_PREFIX."cms_node.nodeid = ".TABLE_PREFIX."cms_nodeinfo.nodeid AND ".TABLE_PREFIX."cms_node.setpublish = 1 AND ".TABLE_PREFIX."cms_node.publishdate >'".$starttime."' ORDER BY ".TABLE_PREFIX."cms_nodeinfo.viewcount desc LIMIT 10; "); $outputbits = ''; while($article = vB::$db->fetch_array($mostpopularweekget)) { $outputbits .='<div class = "cms_widget_post_bit"><h4 class = "cms_widget_post_header"> <a rel="nofollow" href="content.php?r='.$article[nodeid].'">'.$article[title].'</a> </h4> </div>'; } $output = $outputbits; ob_end_clean(); Can we add a bullet at the begining of each article title ? Thay are not separated at all . |
#49
|
|||
|
|||
Sooo... I think I'm noticing a discrepancy... the link has it go to the article plus nodeid, for instance, on my site it's:
http://www.homenetworkenabled.com/content.php?r=129 The actual article address is: http://www.homenetworkenabled.com/co...edia-appliance Which includes the "SEO URL Alias"... both get there, but it appears to be making the viewcount inconsistent... Any way to include the SEO URL Alias so it goes to the correct URL? |
#50
|
|||
|
|||
I think I've done what I've mentioned in the post above, who knows if it's right though... you can see it http://www.homenetworkenabled.com
PHP Code:
|
#51
|
|||
|
|||
I noticed that as well, it was pretty gross looking, I just added a <br>, check out my site above and the code I posted..
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|