Difference between revisions of "Hierarchy: Print Time Functions"
(→class Comment: Added) |
(→class Comment) |
||
Line 99: | Line 99: | ||
<source lang="perl"> | <source lang="perl"> | ||
function Comment::print_time (string datefmt, string timefmt, bool edittime); | function Comment::print_time (string datefmt, string timefmt, bool edittime); | ||
− | </ | + | </source> |
:Same as EntryLite::print_time, except can pass in if we want the edit time or not. | :Same as EntryLite::print_time, except can pass in if we want the edit time or not. | ||
Revision as of 07:28, 8 May 2009
This is an extension of Hierarchy, where you are introduced into the wild and crazy world of layouts and view functions. If you haven't been there yet, start there or this might not make much sense.
Contents
Purpose
Each of these pages is specifically designed to follow a function from how it appears in a view page down to its root functions, variables, and properties. Basically, by the end, you should understand in theory why a function exists and how its put together. Eventually, you will also be able to understand how to alter, change, and even override the functions and both where their variables are stored and why they're there.
In the Beginning
Add text.
Function: print_time
Add text.
class Entrylite
Functions
function print_time () [fixed];
- Print the time of this post, with most useful information for user, and with tooltip for more.
function print_time (string datefmt, string timefmt) [fixed];
Print the time of the post, with customized date/time formats.
Stucture
function EntryLite::print_time() { print $this->time_display(); }
function EntryLite::time_display() : string { return $this->time_display("", ""); }
- Let the real function decide on some nice defaults
function EntryLite::time_display(string datefmt, string timefmt) : string { if ($datefmt == "") {$datefmt = "med";} if ($timefmt == "") {$timefmt = "short";} var string ret; if ($datefmt != "none") { $ret = $ret + $this.time->date_format($datefmt); } if ($datefmt != "none" and $timefmt != "none") { $ret = $ret + " "; } if ($timefmt != "none") { $ret = $ret + $this.time->time_format($timefmt); } return $ret; }
function builtin date_format () : string;
- Returns date formatted as normal. /// SeeAlso: siteapi.core1.dateformats"
function builtin date_format (string fmt) : string;
- Returns date formatted as indicated by \$fmt. One of: short, med, long, med_day, long_day. Or a custom format. Default is 'short'. /// SeeAlso: siteapi.core1.dateformats
function builtin date_format (string fmt, bool linkify) : string;
- Returns date formatted in the same way as calling date_format(string fmt), but with day, month, and year as links to the corresponding archive pages.
function builtin time_format () : string;
- Returns time formatted as normal. /// SeeAlso: siteapi.core1.dateformats
function builtin time_format (string fmt) : string;
- Returns time formatted as indicated by \$fmt, or normal if blank. /// SeeAlso: siteapi.core1.dateformats
class Comment
Function
function Comment::print_time (string datefmt, string timefmt, bool edittime);
- Same as EntryLite::print_time, except can pass in if we want the edit time or not.
Stucture
function Comment::print_time (string datefmt, string timefmt) { $this->print_time($datefmt, $timefmt, false); }