Page 1 of 1

Number of entries per page.

Posted: Wed Dec 01, 2004 8:20 pm
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

Re: Number of entries per page.

Posted: Wed Dec 01, 2004 11:11 pm
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.

Posted: Thu Dec 02, 2004 10:51 am
by Ianardo
Thanks Garvin.
When will 0.8 be finished then?

Posted: Thu Dec 02, 2004 2:14 pm
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

Posted: Thu Dec 02, 2004 5:40 pm
by Ianardo
Yes, I managed it this morning - not too hard at all! :wink:

not seeing where to change things in index.php

Posted: Fri Dec 03, 2004 12:28 am
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?

layout.php

Posted: Fri Dec 03, 2004 12:31 am
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.

Posted: Fri Dec 03, 2004 10:36 am
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!)

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

Posted: Fri Dec 03, 2004 10:47 am
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...

Posted: Thu Mar 30, 2006 10:53 am
by Ianardo
Weird how that answer got there!