- craigh responded to »TagIt 3.0 for Zikula« 03:58 PM
- jmvaughn responded to »error when i try to upgrade to the last version of dizkus module (3.1)« 12:05 PM
- localrags responded to »Remove contents of nuke_sc_anticracker from Database« 11:30 AM
- jmvaughn responded to »Shoutit for zikula 1.3?« 09:31 AM
- mdee responded to »Different page content under one template (tpl file) based on URL« 07:17 AM
- espaan responded to »Categories disappear when editing ...« 08. Feb
- eledril responded to »How decrease zikula cpu usage« 08. Feb
Zikula Blog
- Anatomy of Open Source Projects on Mar 07
- Continuous Review on Mar 01
- Not Invented Here on Feb 24
- How to Contribute Your Code at Github on Jan 13
- 10 Steps to Coding-Nirvana: Tips for Successful Module Writing on Nov 12
- Submitting Bug Report Tickets That Get Results on Aug 17
- Cozi Tricks #1: Syntax Highlighting on Aug 07
Login
top 5 news based on reads
-
**unknown user**
- Rank: Registered User
- Registered: Mar 16, 2002
- Last visit: Oct 21, 2009
- Posts: 25
does anyone know of a block that would look at news from the past week and display the title of the top 5? if now, would someone be interested in writing one? or maybe there is a block close enough that could be modified. -
- Rank: Senior
- Registered: Sep 22, 2003
- Last visit: Oct 21, 2009
- Posts: 2774
Try pasting the following in a PHP block (do not use opening/closing PHP tags):
Code
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
$column = &$pntable['stories_column'];
$result = $dbconn->Execute("SELECT $column[sid], $column[title], DATE_FORMAT($column[time], '%m/%d/%y') FROM $pntable[stories] WHERE (TO_DAYS(NOW()) - TO_DAYS($column[time])) < 8 ORDER BY $column[counter] DESC LIMIT 5");
while (list($sid, $title, $time) = $result->fields) {
$result->MoveNext();
echo '<br>· <a href="modules.php?op=modload&name=News&file=article&sid='.$sid.'" class="pn-normal">'.$title.'</a> ('.$time.')';
}
echo '</div>';
You might-want to double check my query, but I beleive the TO_DAYS business will only fetch records from the last 7 days...
--
Get PhotoGallery, PayPalCart, Dynamenu, Enhanced Blocks & other mods
Cape Cod Travel Info... -
**unknown user**
- Rank: Registered User
- Registered: Mar 16, 2002
- Last visit: Oct 21, 2009
- Posts: 25
Nice...damn, nate...you are on a roll helping me out. I just gotta now figure out how to get the whole deal to fit in the required block space. it looks like it blows out a bit.
www.insidepaint.com
So, wanna tackle another one? How do i remove the reads and author in the today's most read block? I found the part in the code, but I keep breaking it!
Thanks again on the last week's top 5 solution! -
- Rank: Senior
- Registered: Sep 22, 2003
- Last visit: Oct 21, 2009
- Posts: 2774
Looks good... You can of course modify the HTML in the first "echo" statement above and maybe replace the 's with just a space or
or just not have the time altogether. The long word "reorganization" in one of the headlines along with the non-breaking spaces & time is causing the stretching...
As for the today's most read block, that does not look like the default core "big strory" block, but if it is, you can edit includes/blocks/big.php to change it...
--
Get PhotoGallery, PayPalCart, Dynamenu, Enhanced Blocks & other mods
Cape Cod Travel Info...
- Moderated by:
- Support
