To do this, you must first change the date format to display
only the date, not time. This can be done via the "Date Format"
option in Change Settings. Change your date format so that the time
is not displayed. The most common date format used with this
modification is:
<Field: Weekday>, <Field: Month_Name> <Field: Day>, <Field: Year> | Of
course, you can disable the year or weekday if you'd like, just keep
time and time zone off. Then, replace DoNewsHTML in ndisplay.pl with
the following. You can change it to reflect your desired news style.
sub DoNewsHTML {
# Makes $newshtml empty. $newshtml = ""; # Begin by checking if the last date printed is the same as this date. # This uses NewsPro's internal isNewDate subroutine # If the current date is different from the last one, print it if (&isNewDate) { $newshtml .= qq~<h2><font color="#ff0000">$newsdate</font></h2>~; } # That's it for printing the date! Easy! Now just go on and print the news # (without the date, of course). Notice the use of .= rather than = $newshtml .= qq~ <p><strong>$newssubject</strong><small> Posted by <a href="mailto:$newsemail">$newsname</a></small><br> $newstext</p> ~; } | IMPORTANT:
When you edit ndisplay.pl manually (which, if you put in the code
above, you've just done), you must remove the ! from
the #<Manual!Edit> line. More details on doing this are
at the top of ndisplay.pl.
Another frequent request is to
have the date above all the day's news, but the time each item was
posted with the item. This too is possible, because the routine used
to generate the date sets quite a few variables, such as $Hour,
$Minute, $Second, and $Time_Zone. So, to achieve the style with the
news above and the time with every news post, use the following to
print out the news:
$newshtml .= qq~ <p><strong>$newssubject</strong><small> Posted by <a href="mailto:$newsemail">$newsname</a> \@ $Hour:$Minute</small><br> $newstext</p> ~; | Notice
the @ sign is "escaped" as \@. That's what you have to do with many
characters writing Perl.
The list of date/time variables:
$Second, $Minute, $Hour, $AMPM, $ActualMonth, $Month_Day (the date),
$Week_Day (counting from 0: Sunday is 0, Saturday 6), $Year, and
$Time_Zone. (Another FAQ entry gives the full
list.)
|