Wickd
The first member of the Knights of the Pink Table
- Jan 15, 2013
- 1,936
- 612
Hey DevBest, Wickd here.
I'll be releasing a small script that allows News Archiving on RevCMS!I hope you boys will enjoy this!
How to set up this script? (If running on r63b make sure you change from "cms_news" to "site_news")
I'll be releasing a small script that allows News Archiving on RevCMS!I hope you boys will enjoy this!
How to set up this script? (If running on r63b make sure you change from "cms_news" to "site_news")
- Locate "
<div id="article-archive">
<ul>" - After that paste this code
Code:<?php { for ($i = 0; $i < 6; $i++) { $sectionName = ""; $sectionCutoffMax = 0; $sectionCutoffMin = 0; switch ($i) { case 0: $sectionName = 'Today'; $sectionCutoffMax = time(); $sectionCutoffMin = time() - 86400; break; case 1: $sectionName = 'Yesterday'; $sectionCutoffMax = time() - 86400; $sectionCutoffMin = time() - 172800; break; case 2: $sectionName = 'This week'; $sectionCutoffMax = time() - 172800; $sectionCutoffMin = time() - 604800; break; case 3: $sectionName = 'Last week'; $sectionCutoffMax = time() - 604800; $sectionCutoffMin = time() - 1209600; break; case 4: $sectionName = 'This month'; $sectionCutoffMax = time() - 1209600; $sectionCutoffMin = time() - 2592000; break; case 5: $sectionName = 'Last month'; $sectionCutoffMax = time() - 2592000; $sectionCutoffMin = time() - 5184000; break; } $q = "SELECT * FROM cms_news WHERE published >= " . $sectionCutoffMin . " AND published <= " . $sectionCutoffMax . " ORDER BY published DESC"; $getArticles = mysql_query($q); if (mysql_num_rows($getArticles) > 0) { echo '<h2>' . $sectionName . '</h2> <ul>'; while ($a = mysql_fetch_assoc($getArticles)) { echo '<li> <a href="http://lwickedev.net/index.php?url=news&id=' . $a['id'] . '">' . $a['title'] . ' »</a> </li>'; } echo '</ul>'; } } } ?>
Last edited: