Display "Most Recent" Day Option?

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
genesis
Regular
Posts: 28
Joined: Wed Jun 11, 2008 5:26 pm

Display "Most Recent" Day Option?

Post by genesis »

Serendipity allows me to select how many articles I want to display on the top of the blog if someone just goes to the top-level page.

What I'd really like is the ability to say "display all articles from the most-recent calendar DAY on the top-level page."

I've been toying with the code but have yet to figure out a way to do this.

Thoughts?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Display "Most Recent" Day Option?

Post by garvinhicking »

Hi!

Can you elaborate on the usage case? Is this a blog that has many entries on a single day?

It can be done through custom templating, like the mimbo templates actually do. For that, a custom startpage template needs to be created (i.e. by creating a custom staticpage) that uses the Smarty {serendipity_fetchPrintEntries} function to specifiy an actual day to show the entries of.

An alternative to this would be an event plugin that hooks into the entry function feature; if you're a PHP-pro, this would be the easier option for you - for all other people, the Smarty-approach is the most flexible.

If you want to get even dirtier, you could patch the include/genpage.inc.php file with a code like this:

Code: Select all

if ($serendipity['view'] == 'start') {
  $serendipity['range'] = array(mktime(0, 0, 0, date('m'), date('d')-1, date('Y')), mktime(23, 59, 59, date('m'), date('d'), date('Y')));
  $serendipity['fetchLimit'] = 999;
}
That would actually display all entries from yesterday to today. You might want to spice up that code to check the database itself from when the most recent entry is (check on max(timestamp) on the serendipity_entries table).

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
genesis
Regular
Posts: 28
Joined: Wed Jun 11, 2008 5:26 pm

Post by genesis »

It varies from zero entries on a given day to several - sometimes five or more (rarely that many tho)

The problem is that if I post a new entry on a given day the older one(s) go "below the fold" quickly. A lot of readers come check it once a day, so this causes them to miss things. They've asked if there's a way to have it show everything for the current day; this is one of the default settings you can specify on Blogger, where it used to be before I converted over last year.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Hm, but using your new mechanism to only shows entries of a single day would put entries much quicker out of sight.

If you post one entry today, and three tomorrow then visitors would only see 3 entries tomorrow, and not the one from today. IMHO the ability to scroll down is one of the most important ones in blogs, and quite beneficial and established.

Showing only entries of a single day on the default page is very uncommon to blogs - which is why serendipity does not support this out of the box. Out of the box, Serendipity really shows X entries per page, which is to most readers the most comprehensible way to follow the "flow" of a blog.

If people only want a single day view, have you told them to use the sidebar calendar? There, all days that have postings are highlighted and can be clicked!

I've not seen this kind of display in a blog yet, do you have a Blogger-Link to show me how it exactly "looks" like?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
genesis
Regular
Posts: 28
Joined: Wed Jun 11, 2008 5:26 pm

Post by genesis »

I guess its a preference issue..... I used to run it with "Days" as my default on Blogger and people got used to it....
Post Reply