<?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 '<br>';
echo '<h2>' . $sectionName . '</h2>';
while ($a = mysql_fetch_assoc($getArticles))
{
if($a['id'] == $_GET['id'])
{
echo '' . $a['title'] . ' »<br>';
}
else
{
echo '<li><a href="/articles/' . $a['id'] . '">' . $a['title'] . ' »</a></li>';
}
}
}
}
}
?>
I think you mis understood him. From my understanding he want the active article to change from orange to black in the sidebar.Try this pal, you'll want to put this under your " news " tab.PHP:<?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 '<br>'; echo '<h2>' . $sectionName . '</h2>'; while ($a = mysql_fetch_assoc($getArticles)) { if($a['id'] == $_GET['id']) { echo '' . $a['title'] . ' »<br>'; } else { echo '<li><a href="/articles/' . $a['id'] . '">' . $a['title'] . ' »</a></li>'; } } } } } ?>
I think you mis understood him. From my understanding he want the active article to change from orange to black in the sidebar.
A way you could do it is to grab URL and match the id's together then change the matching one to black.
I didnt read all of your code, thought you gave him the code to sort the articles into "categories", my bad! your code seems to do what he asked for aswell, even tho he it seems he fixed itI was pretty sure he was talking about this, unless it's wrong and he needs to reword it around.
You must be registered for see images attach