Comment Plugin (0.9.3)

Feed 1 posts, 2 voices

Aug 2, 2008 08:58
Avatar
259 posts

I'm not sure if anyone cares. It took me a few to figure out how the dates under each of the comments, using the new comment plugin, are created. So, I figured I'd post something to save someone else a headache.

In your file:

/frog/plugins/comment/index.php

Find the line that looks like (approximately line 160):

        function date($format='%a, %e %b %Y')

Currently that formats a page to look like:

Fri, 1 Jan 2008

It is formatted according to the strftime() standards. Therefore,

        function date($format='at %I:%M %p on %a, %e %b %Y')

Will produce results that look like:

at 01:25 pm on Fri, 1 Jan 2008

Hope that helps someone.

 
Aug 2, 2008 09:34
Avatar
818 posts

That is a help ... but it is even easier that this looks! In the documentation on displaying the date of a page you can see some date setting code. In the default installation, you get this on the "Articles" page, for example:

<?php echo $article->date(); ?>

You can simply insert mtylerb's code into this line:

<?php echo $article->date('at %I:%M %p on %a, %e %b %Y'); ?>

I have noticed one little "problem" with pages that have not been updated. Instead of getting nothing, or the create date, you get 1 Jan 1970 ... or some date from 1970, anyway! To solve this problem for my site where I have a little "This page last updated:" line on every page, I have this:

<?php if ($this->date('%Y','updated') != '1970'): ?>
    <p style="color:#ccc"><small>
    This page last updated: <?php echo $this->date('%a, %e %b %Y', 'updated'); ?>
    </small></p>
<?php endif; ?>

There is probably a more elegant way of doing it, but that works for me! Learning all the time...!! :)