Number of entries per page.

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
Ianardo
Regular
Posts: 114
Joined: Sun Nov 28, 2004 3:02 pm
Location: Hastings, U.K.
Contact:

Number of entries per page.

Post by Ianardo »

Is there an easy way to reduce the number of entries shown on each page - or even better, to archive all entries that are from the previous month.
Cheers
Ian
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Number of entries per page.

Post by garvinhicking »

Serendipity 0.8 supports the configuration directive 'fetchLimit' to change that easily, how many posts are displayed.

In 0.7 you need to edit the layout.php file and adjust the number '15' to the amount of entries you want to display.

A blog usually always shows the last X entries and never only the ones for a month. If you want this, you'd need to hack certain things. See the $serendipity['range'] command and set it appropriately in index.php or your layout.php file to hardwire that always the actual month is shown if no range is set.

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/
Ianardo
Regular
Posts: 114
Joined: Sun Nov 28, 2004 3:02 pm
Location: Hastings, U.K.
Contact:

Post by Ianardo »

Thanks Garvin.
When will 0.8 be finished then?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

That can still be a few weeks or even months away. But it's already quite usable, so you may just want to check it out :)

But regarding replacing the '15' in your layout.php is also not that hard, so you can of course stick with 0.7 a little while longer :)

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/
Ianardo
Regular
Posts: 114
Joined: Sun Nov 28, 2004 3:02 pm
Location: Hastings, U.K.
Contact:

Post by Ianardo »

Yes, I managed it this morning - not too hard at all! :wink:
devnet

not seeing where to change things in index.php

Post by devnet »

you say to change the range...I see no place to change it. That is, when looking for the word range...it appears about 20 times in index.php


So where does one set the range? I know it is an assigned value ($range) so where does one define this?
TKS
Regular
Posts: 199
Joined: Thu Nov 11, 2004 1:34 am
Location: VA, USA
Contact:

layout.php

Post by TKS »

Also,

What layout.php file are we supposed to adjust if the theme used has its own layout.php? Do we adjust that one, the default directory, or both?

Just wondering on that.
Ianardo
Regular
Posts: 114
Joined: Sun Nov 28, 2004 3:02 pm
Location: Hastings, U.K.
Contact:

Post by Ianardo »

This is the bit of code you want to change:

Code: Select all

// The main area
switch ($serendipity['GET']['action']) {
    // User wants to read the diary
    case 'read':
        if (isset($serendipity['GET']['id'])) {
            serendipity_printEntries(array(serendipity_fetchEntry('id', $serendipity['GET']['id'])), 1);
        } else {
            serendipity_printEntries(serendipity_fetchEntries($serendipity['GET']['range'], true, 10));
        }
        break;
Where I have the '10' is the number you change.
This is from my defaults theme, I assume that if you have a custom layout.php you will still have this in it (if you changed it you would know what it was anyway!)
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: not seeing where to change things in index.php

Post by garvinhicking »

Hi Devnet!
devnet wrote:you say to change the range...I see no place to change it. That is, when looking for the word range...it appears about 20 times in index.php
So where does one set the range? I know it is an assigned value ($range) so where does one define this?
You should also edit your layout.php, which would be the easiest way. There you can search for $serendipity['GET']['range'] and assign it, if it's empty...
# 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/
Ianardo
Regular
Posts: 114
Joined: Sun Nov 28, 2004 3:02 pm
Location: Hastings, U.K.
Contact:

Post by Ianardo »

Weird how that answer got there!
Post Reply