[HELP] RevCMS news sorted by post date?

Abidas

New Member
Oct 22, 2012
14
2
Hello fellow Rev users, I would like to know if it's possible to make the RevCMS news page look like:
FWwWyon.png

Instead of:
3o62.png

And if so, how is it done?

med venlig hilsen.
 

Khalil

IDK
Dec 6, 2011
1,642
786
I'm pretty sure you could just go to class.forms.php and edit where it says 'ORDER BY id' to 'ORDER BY date' or w/e the column is called in the 'cms_news' table. &
 

Abidas

New Member
Oct 22, 2012
14
2
Hai, I haven't been on DevBest for a while, and just noticed this old thread. If anyone is interested in a fix, I found on - here you go:

1. Open news.php and replace {newslist} with;
<?php
for ($i = 0; $i < 7; $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() - (60 * 60 * 24 * 365);
break;
}

$q = "SELECT * FROM cms_news WHERE published >= " . $sectionCutoffMin . " AND published <= " . $sectionCutoffMax . " ORDER BY published DESC LIMIT 50";
$getArticles = mysql_query($q);

if (mysql_num_rows($getArticles) > 0)
{
echo '<h2>' . $sectionName . '</h2>
<ul>';

while ($a = mysql_fetch_assoc($getArticles))
{
?>

<li><?php if($news_id !== $a['id']){ echo"<a href=\"".$path."/index.php?url=news&id=".$a['id']."\">"; } ?>
<?php echo $a['title']; ?> &raquo;</a>
<?php if($news_id !== $a['id']){ echo"</a>"; } ?></li>
<?php }
echo '</ul>';
}
}
?>
 

Wickd

The first member of the Knights of the Pink Table
Jan 15, 2013
1,936
612
Hai, I haven't been on DevBest for a while, and just noticed this old thread. If anyone is interested in a fix, I found on - here you go:

1. Open news.php and replace {newslist} with;
<?php
for ($i = 0; $i < 7; $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() - (60 * 60 * 24 * 365);
break;
}

$q = "SELECT * FROM cms_news WHERE published >= " . $sectionCutoffMin . " AND published <= " . $sectionCutoffMax . " ORDER BY published DESC LIMIT 50";
$getArticles = mysql_query($q);

if (mysql_num_rows($getArticles) > 0)
{
echo '<h2>' . $sectionName . '</h2>
<ul>';

while ($a = mysql_fetch_assoc($getArticles))
{
?>

<li><?php if($news_id !== $a['id']){ echo"<a href=\"".$path."/index.php?url=news&id=".$a['id']."\">"; } ?>
<?php echo $a['title']; ?> &raquo;</a>
<?php if($news_id !== $a['id']){ echo"</a>"; } ?></li>
<?php }
echo '</ul>';
}
}
?>
Not sure that'll work.
 

Users who are viewing this thread

Top