I am creating a CMS for my website and would like some advice on the following.
I have created a page that shows one field of the sql database (This is a link to an edit page for the whole record, each record has a field where the current_timestamp is stored when it is updated). Using DW CS3 and extensions, I have repeated this field vertically and horizontally so that it fills the page and subsequent pages through pagination coding.
What I would like to do is either change the background colour of the field displayed or display an image alongside the field to show it has been updated in the last week.
To do this I know that I need to compare the dates and get a result.
$timenow = time()
$days = (60*60*24*7); //Where 7 represents the number of days
$updated = $timenow - $days;
$timeupdate = $rows_rsTable ['recordUpdate']; // recordUpdate is where current_timestamp is stored when record is updated in sql.
<table>
<tr><td><?php
// Horizontal Looper start code for rsTable
do {
ob_start();
?>
<span class="-----CCS here-----"><a href="edit.php?id=<?php echo $row_rsTable['recordID']; ?>"><?php echo $row_rsTable['OrigNumber']; ?></a> ----- IMAGE here -----</span>
<?php
// HLooper manage the arrays for rsTable
$HLoop_rsTable_temp = ob_get_contents(); //dump buffer to variable
ob_end_clean(); //clear buffer
$HLoop_rsTable[$HLoop_rsTable_i][$HLoop_rsTable_ii] = $HLoop_rsTable_temp;
$HLoop_rsTable_ii++;
if($HLoop_rsTable_ii >= $HLoop_rsTable_loopTo){
$HLoop_rsTable_i++;
$HLoop_rsTable_ii = 0;
$HLoop_rsTable_actualrows++;
};
} while ($row_rsTable = mysql_fetch_assoc($rsTable));
if($HLoop_rsTable_actualrows < $HLoop_rsTable_rows && $HLoop_rsTable_vertical == "false")
$HLoop_rsTable_rows = $HLoop_rsTable_actualrows;
if($HLoop_rsTable_actualrows < $HLoop_rsTable_columns && $HLoop_rsTable_vertical == "true")
$HLoop_rsTable_columns = $HLoop_rsTable_actualrows;
?>
<table class="hloop">
<?php for($i = 0; $i < $HLoop_rsTable_rows; $i++) { ?>
<tr>
<?php for($ii = 0; $ii < $HLoop_rsTable_columns; $ii++) { ?>
<td><?php
if($HLoop_rsTable_vertical == "true") {
echo(isset($HLoop_rsTable[$ii][$i]) ? $HLoop_rsTable[$ii][$i] : " ");
}else{
echo(isset($HLoop_rsTable[$i][$ii]) ? $HLoop_rsTable[$i][$ii] : " ");
} ?></td>
<?php } ?>
</tr>
<?php } // End Horizontal/Vertical Looper code for rsTable ?>
</table></td>
</tr>
<tr><td align="center"><?php
for ($i=0; $i <= $totalPages_rsTable; $i++) {
$eeg_PagesEndCount = $i + 1;
if($i != $pageNum_rsTable) {
printf('<a href="'."%s?pageNum_rsTable=%d%s", $currentPage, $i,
$queryString_rsTable.'">'.$eeg_PagesEndCount."</a>");
}else{
echo("<strong>[$eeg_PagesEndCount]</strong>");
}
if($i != $totalPages_rsTable) echo(" | ");
}
?></td></tr></table>
In my CSS table I have a .recordUpdate input with the background colour #CCCCFF; and at present I also have an image called 'update.png' in the image folder.
I know what I need to do, but cannot figure out how to do it, my attempts have resulted in all background colours changing or images being published.
Any advice would be appreciated.
phil