More than 5 results on Search.php

10 views
Skip to first unread message

Adam

unread,
Apr 29, 2008, 6:00:13 AM4/29/08
to habari-users
On my homepage, I have 5 articles displayed I like this its a good
number although I would like some sort of control as to how many
articles are viewable at any one go. Similarly, on my search and tag
results pages I would like more then 5 results displayed at any one
time.

I've not found any mention of this in the documentation/wiki although
I might not be searching for the logical keywords.

Michael C. Harris

unread,
Apr 29, 2008, 7:15:48 AM4/29/08
to habari...@googlegroups.com

You can control the number of posts that are returned by default under
Admin | Options | Number of items per page.

If that's not in the wiki, it definitely should be. If no-one looks at
that overnight (my night, goodnight Australia) I'll look at it
tomorrow.

--
Michael C. Harris, School of CS&IT, RMIT University
http://twofishcreative.com/michael/blog

Adam

unread,
Apr 29, 2008, 8:37:40 AM4/29/08
to habari-users
Thanks for the reply Michael, there wasn't an entry so I added one:
http://wiki.habariproject.org/en/Returned_Items

That said, I would like to be able to change the number of results on
the search page to say 7 and the home page to stay at 5, is there a
way of doing this? I'll add it to the wiki page once I know how to do
it.

Michael C. Harris

unread,
Apr 29, 2008, 8:12:04 PM4/29/08
to habari...@googlegroups.com
On Tue, Apr 29, 2008 at 05:37:40AM -0700, Adam wrote:
>
> Thanks for the reply Michael, there wasn't an entry so I added one:
> http://wiki.habariproject.org/en/Returned_Items

Great!

> That said, I would like to be able to change the number of results on
> the search page to say 7 and the home page to stay at 5, is there a
> way of doing this? I'll add it to the wiki page once I know how to do
> it.

You can't do that through configuration, but you could by adding some
hooks in your theme.php. (Someone may jump in here to help you with
that if you express an interest in it.)

Adam

unread,
Apr 29, 2008, 8:44:29 PM4/29/08
to habari-users
Well, I suppose this is as good a time as ever to try and join in the
community... so I'll try and make a stab at getting this working
tomorrow. That said, I have no idea what I am doing, but that is no
reason not to try.

Any pointers would be welcome though, because I envisage 12 hours of
swearing and drinking more than my body weight in tea.

On Apr 30, 1:12 am, "Michael C. Harris" <michael.twof...@gmail.com>
wrote:

Rich Bowen

unread,
Apr 29, 2008, 8:47:06 PM4/29/08
to habari...@googlegroups.com
On Apr 29, 2008, at 20:44, Adam wrote:
Any pointers would be welcome though, because I envisage 12 hours of
swearing and drinking more than my body weight in tea.


Well, here's what I would offer as a pointer. Tea is clearly the wrong thing to drink when attempting to hack on Habari.

Glad I could help.

--
Happiness isn't something you experience; it's something you remember.
Oscar Levant

Adam

unread,
Apr 29, 2008, 8:50:42 PM4/29/08
to habari-users
I'm British. I have tea flowing through my veins.

Michael Bishop

unread,
Apr 29, 2008, 9:19:24 PM4/29/08
to habari-users
I'm not sure of a way to specify by page, but you could change the #
of posts to be shown in options to say, 7 and then if you only want 5
(or any number for that matter) to show on home, you could add this to
your theme.php file

public function act_display_home()
{
parent::act_display_home( array( 'limit'=> 5 ) );
}

Note this is only for home.php display, if you have an entry.multiple
template, then use the pagination, page/2 would show the number of
posts you've set in your option. This is handy especially if you want
to show just a couple of posts on the home page, but have more on any
other multiple entry page like tag or search.

Hope that helps. I tend to add this at the very end of theme.php,
before the closing brace for the class MyClass extends theme.

~miklb

Matt Read

unread,
Apr 29, 2008, 10:29:15 PM4/29/08
to habari...@googlegroups.com
> That said, I would like to be able to change the number of results on
> the search page to say 7 and the home page to stay at 5, is there a
> way of doing this? I'll add it to the wiki page once I know how to do
> it.

A "work in progress" plugin but does what you are looking for; install
to plugins/customquery:

source:
http://drunkenmonkey.org/source/user/plugins/customquery/customquery.plugin.php

download:
http://drunkenmonkey.org/source/raw/user/plugins/customquery/customquery.plugin.php

Maybe someday I'll get around to putting it on -extras, unless someone
does it for me :)

signature.asc

Adam

unread,
Apr 30, 2008, 8:16:02 AM4/30/08
to habari-users
Ah, Matt that is exactly what is needed. Works a treat, many thanks.

On Apr 30, 3:29 am, Matt Read <matt.r.r...@gmail.com> wrote:
> > That said, I would like to be able to change the number of results on
> > the search page to say 7 and the home page to stay at 5, is there a
> > way of doing this? I'll add it to the wiki page once I know how to do
> > it.
>
> A "work in progress" plugin but does what you are looking for; install
> to plugins/customquery:
>
> source:http://drunkenmonkey.org/source/user/plugins/customquery/customquery....
>
> download:http://drunkenmonkey.org/source/raw/user/plugins/customquery/customqu...
>
> Maybe someday I'll get around to putting it on -extras, unless someone
> does it for me :)
>
>  signature.asc
> 1KDownload
Reply all
Reply to author
Forward
0 new messages