Multiple entries leading to multiple pages

1 view
Skip to first unread message

Tatsui

unread,
Oct 21, 2008, 1:34:44 AM10/21/08
to habari-users
So it's been a week since I started using Habari. I have set to
publish 5 entries per page and notice the Next arrow and page numbers
are showing on the bottom for users to go to the oldest entries. I
didn't notice the bug until I got 3 pages up. The Next arrow will only
go to Page 2 after clicking it. So from page 1 to 2 makes sense, but
from 3 - 4 (clicking Next) will bring you back to Page 2. I tried
looking to see where this error could be, but I haven't figured it out
yet.

FYI - I'm using Whitespace theme on my habari.

Andy C

unread,
Oct 21, 2008, 9:50:00 AM10/21/08
to habari-users
Well, the relevant code snippet is in 'entry.multiple.php'

entry.multiple.php: Page: <?php $theme->prev_page_link(); ?> <?php
$theme->page_selector( null, array( 'leftSide' => 2, 'rightSide' =>
2 ) ); ?> <?php $theme->next_page_link(); ?>

However, this is the same as K2 (which works) so this bug is obviously
specific to Whitespace.

Although I did the original port, I don't have a clue as I can't spell
PHP.

Hopefully, someone clever will wander along soon and help us out.
--
Andy

Andy C

unread,
Oct 28, 2008, 11:09:30 AM10/28/08
to habari-users
$ diff theme.php theme.php~
66c66
< $this->assign('page', isset( $this->page ) ? $this-
>page : 1 );
---
> $this->assign('page', isset( $page ) ? $page : 1 );

fixes this problem.

Tatsui

unread,
Oct 28, 2008, 10:56:40 PM10/28/08
to habari-users
Hi Andy,

I'm note sure what you just wrote there but was able to find the code
in the theme.php file on line 66. The php file already contains this
line:

LINE66: $this->assign('page', isset( $page ) ? $page : 1 );
}

I read over your comment a few times and not sure if you are
suggesting to add the extra lines above the original line of command?
I'm quite a novice with php files so bear with me. Much thanks for the
help! Hopefully I get this straightened out. Thanks again! Let me
know.
Jeff

rick c

unread,
Oct 29, 2008, 12:16:26 AM10/29/08
to habari-users
Tatsui,

Andy was suggesting that you replace the current line with

$this->assign( 'page', isset( $this->page ) ? $this->page : 1 );

Rick

Andy C

unread,
Oct 29, 2008, 4:14:26 AM10/29/08
to habari-users
Jeff - Yes. Rick is correct. The '$page' reference must be replaced
with '$this->page' in two places.

Rick - For the sake of completeness and my knowledge, does the
addition of the 'this->' change the scope and the object being
referenced here ?

Initially, I thought this was a purely a cosmetic change and
functionally equivalent.
--
Andy

rick c

unread,
Oct 29, 2008, 7:29:34 AM10/29/08
to habari-users
Andy,

To the best of my knowledge, yes, the addition of 'this' changes the
scope. Until about 6 months ago the page selector function was part of
the Utils class and $page was pretty much global. At that time the
page selector function was moved and became part of the Theme class,
of which all themes are subclasses. $page became part of the Theme
class, too.

In all actuality, the assignment that we're talking about here doesn't
really need to be done in the individual theme class, since
Theme::add_template_vars() assigns it and $user, so individual themes
don't have to assign either variable. Mzingi and Charcoal, for example
don't contain the $page assignment at all. K2 still does, but it could
be removed.

I hope this helps.

Rick

Andy C

unread,
Oct 29, 2008, 10:40:02 AM10/29/08
to habari-users
Rick

As always, many thanks for the considered and detailed reply in terms
I can understand :-)

That info helps to explain why the page navigation used to work (in
Whitespace) and no longer does.

The option of removing the assignment completely from 'theme.php' is
an attractive one.

Less is (almost always) more.
--
Andy

Tatsui

unread,
Oct 29, 2008, 11:27:25 AM10/29/08
to habari-users
Rick & Andy,
You guys were very helpful! It worked... Much appreciated with the
habari community being very accommodating and helpful!
Jeff
Reply all
Reply to author
Forward
0 new messages