View Single Post
Old
  (#5 (permalink))
Lateron
Junior Member
 
Status: Offline
Posts: 34
Join Date: Nov 2002
Location: Australia
08-03-2003, 08:42 PM

Thank you, Dar63.

I am +15 hours ahead of my server and now my Forum block is showing local time. In the index.php file there is datetime(4) and if you change that to datetime(4)+15 that works. I had tried the same thing with the forum block but hadn't thought about trying seconds. My inexperience shows ops:

This is the code for a similar block which shows the last ten comments on homepage articles. Would I be stretching the friendship if I asked you if a simple change is possible here to show local time? (The sad emoticons are there because there are colons in the code at those spots.)

Quote:
<?php


/**
This block shows the most recent comments on a PHP Nuke based website.
*/

/*
* You can adjust the number of comments to be displayed.
*/
$nr = 10;

/*
* Important: setting this to 1 requires a change in your webserver's configuration (a redirect from article/* to modules/php?name=News...)
*/
$shorturl = 0;


if (eregi("block-Recent_Comments.php",$PHP_SELF)) {
Header("Location: index.php");
die();
}

global $prefix, $dbi, $anonymous;

$a = 1;

$content = "";
$result2 = sql_query("select name,sid,date,subject from ".$prefix."_comments order by date DESC limit $nr", $dbi);
while (list($c_name, $sid, $c_date,$c_subject) = sql_fetch_row($result2, $dbi)) {
if ($a <= $nr) {

$title2 = ereg_replace("_", " ", $title);
if (!eregi("[a-z0-9]",$c_name)) $c_name = $anonymous;
$nicedate = formatTimestamp($c_date);

$c_subject = str_replace("Re:","",$c_subject);
if ($shorturl) {
$urlto = "article/$sid";
} else {
$urlto = "modules.php?name=News&amp;file=article&amp;sid=$s id";
}
$content .= "<a href=\"$urlto\" title=\"$nicedate\">$c_name</a>: $c_subject ";
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2})[0-9]{1,2})[0-9]{1,2})", $c_date, $datetime);
$day = $datetime[3];
$month = $datetime[2];
$daytoday = date("d");
$monthtoday = date("m");

$hour = $datetime[4];
$minute = $datetime[5];
if (($day == $daytoday) && ($month == $monthtoday)) { //ignoring year here.
$content .= "<font class=\"tiny\">($hour:$minute)</font>
";
} else {

$content .= "<font class=\"tiny\">(". intval($day) . "/" . intval($month) . ")</font>
";
}
}
$a++;
}


?>
Thanks once again,
Ron...
   
Reply With Quote