Pagination issue
|
rve66
Joined: 2009-09-10
Posts: 31 |
Posted: Thu, 2009-10-01 15:20
|
|
Hi, how can i set pagination to "digg"???? -RvE |
|
|
rve66
Joined: 2009-09-10
Posts: 31 |
Posted: Thu, 2009-10-01 15:20
|
|
Hi, how can i set pagination to "digg"???? -RvE |
|
Posts: 16503
I've been trying to figure that out, but haven't had much time since 9/27
If you hit the IRC logs from 9/27 you'll see the conversation I was having with talmdal and bharat to get some help there:
http://codex.gallery2.org/IRC
http://tools.gallery2.org/
Here's the meat of the end of the conversation, basically we're not using Kohana's pagination right now, but use to so finding some old files (see the git repo) would be the starting path:
I haven't found the time to go back to that though.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 2139
I went through the current code and I am under impression that current Kohana is actually old.
Kohana 3.0 released on 2009-09-16, but from kohana.php we use 2009-05-28.
May be reason is that we are not latest codebase?
From the page above, we should have all default styles provided by Kohana, yet current codebase only have 'default' style.
Posts: 16503
That's not the reason. Follow the links I posted.
There is, however, a reason (or several) why we are not using Kohana 3.0. I don't know them off the top of my head, but feel free to join the -devel mailing list and ask or search the archives or join in on #gallery and ask there or search the IRC logs, or post a thread specifically about that in the forums.
I'm not a developer and wasn't directly involved in that decision. I believe it may have been that we were headed down the path of using Kohana before 3.0 was released and upgrading is apparently not a simple matter. It also appears there is a rift in the Kohana community about some decisions that were made on that front.
http://codex.gallery2.org/Mailing_Lists
http://www.nabble.com/forum/Search.jtp?forum=3818&local=y&query=kohana
http://codex.gallery2.org/IRC
http://tools.gallery2.org/
There is someone from the Kohana community how hangs out in #gallery quite a bit. I don't now if he's just a user or Kohana developer or what though.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 2139
This is the code for digg style (from kohana)
It need to be adopted for G3 style though. I will try incorporate it in my theme some time soon
Posts: 16503
oh and read my post above, we were using Kohana pagination directly, but are not any longer. Talmdal and Bharat both post what we'd need to do to go back to using Kohana pagination.
You can find old versions of the code here: http://github.com/gallery/gallery3/commits/master/themes/default/views/pager.html.php
Again, I've barely even started digging into this.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 16503
COOL! I'd love to see that. And learn from what you come up with.
Thanks for all of your contributions Serge! It does help out.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 2139
@nivekiam: I am in the list, but I have no time available to spend there, sorry.
I've heard about the rift... politics
Going through the code above (kohana style), default logic is all text, there is no room for styles there. I think it is one reason no to use default kohana adapter.
But what can be done is a port of logic above for G3. And this what I am going concentrate on.
Posts: 16503
Which just sucks for all involved...
Great! I'm glad you can see that better than I can. I thought about that, then looked at what I think was the same example as you posted and just didn't see it
But you work with code more than I do.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 31
Put this in pager.html.php, for me it seems to work (table is used to make it visible and style I leave to others to use own style
)
<table border="2">
<tr>
<td>
<p class="pagination">
<? if ($previous_page): ?>
<a href="<?= str_replace('{page}', $previous_page, $url) ?>">« <?= t("previous") ?></a>
<? else: ?>
« <?= t("previous") ?>
<? endif; ?>
</p>
</td>
<td>
<? if ($total_pages < 13): ?>
<? for ($i = 1; $i <= $total_pages; $i++): ?>
<? if ($i == $current_page): ?>
<strong><?= t( $i ) ?></strong>
<? else: ?>
<a href="<?= str_replace('{page}', $i, $url) ?>"><?= t( $i ) ?></a>
<? endif; ?>
<? endfor ?>
<? elseif ($current_page < 9): ?>
<? for ($i = 1; $i <= 10; $i++): ?>
<? if ($i == $current_page): ?>
<strong><?= t( $i ) ?></strong>
<? else: ?>
<a href="<?= str_replace('{page}', $i, $url) ?>"><?= t( $i ) ?></a>
<? endif; ?>
<? endfor ?>
…
<a href="<?= str_replace('{page}', $total_pages - 1, $url) ?>"><?= t( $total_pages - 1 ) ?></a>
<a href="<?= str_replace('{page}', $total_pages, $url) ?>"><?= t( $total_pages ) ?></a>
<? elseif ($current_page > $total_pages - 8): ?>
<a href="<?= str_replace('{page}', 1, $url) ?>">1</a>
<a href="<?= str_replace('{page}', 2, $url) ?>">2</a>
…
<? for ($i = $total_pages - 9; $i <= $total_pages; $i++): ?>
<? if ($i == $current_page): ?>
<strong><?= t( $i ) ?></strong>
<? else: ?>
<a href="<?= str_replace('{page}', $i, $url) ?>"><?= t( $i ) ?></a>
<? endif; ?>
<? endfor ?>
<? else: ?>
<a href="<?= str_replace('{page}', 1, $url) ?>">1</a>
<a href="<?= str_replace('{page}', 2, $url) ?>">2</a>
…
<? for ($i = $current_page - 5; $i <= $current_page + 5; $i++): ?>
<? if ($i == $current_page): ?>
<strong><?= t( $i ) ?></strong>
<? else: ?>
<a href="<?= str_replace('{page}', $i, $url) ?>"><?= t( $i ) ?></a>
<? endif; ?>
<? endfor ?>
…
<a href="<?= str_replace('{page}', $total_pages - 1, $url) ?>"><?= t( $total_pages - 1 ) ?></a>
<a href="<?= str_replace('{page}', $total_pages, $url) ?>"><?= t( $total_pages ) ?></a>
<? endif; ?>
</td>
<td>
<? if ($next_page): ?>
<a href="<?= str_replace('{page}', $next_page, $url) ?>"><?= t("next") ?> »</a>
<? else: ?>
<?= t("next") ?> »
<? endif; ?>
</td>
</tr>
</table>
Thank you Serge for pointing to the needed basic code
-RvE
Posts: 2139
@rve66: this is basic, text only code from Kohana distro itself.
.
If anyone interested in other styles mentioned in original article, just use google
I want to point on the fact that this is a starting point for the authors, while next step would be to adjust a markup to follow theme's style.
Posts: 31
@SergeD: I understand you wrote it in original entry but also it need worked on.
I adjusted the code and the pagination is working like wanted (digg like) I did not added styling arround it because I think thats up to everyone itself. For me it's styled like my page is NewClassic!
Posts: 2139
Oh, yes I've noticed that.
You use tables as well which is not a style of G3
but it is a different topic.
My point was that for this code to be seamless for default theme, it need to be adjusted to use <span> syntax to make up buttons.
You have a good code nevertheless.
Posts: 31
Yeah I noticed already tables are not used to much in G3 (they are there but not much)
) maybe give me a pm what you think about it!
And yes its other topic (table or not
In case of this sample I only used the TABLE option with a BORDER="2" in order for others to find simply the place to adjust it for there needs.
Sure to make it like all other things it should be more DIV UL LI SPAN style. Maybe i will do it completly like this on my site but for know I have what I wanted digg style
Any way, it was your theme made me happy to work on G3. At first I was not happy with G3 but once I saw your first theme work I turned and am now to go for G3 only (still needs worked on but well we also can help and I think we do by adding at first stage custom themes right)
In the end I think both do what we like. We do have questions about the product but we also contribute, as far as we can, to the product (I hope) right!
Posts: 2139
Ok, I think I got it working with my theme.
pager.html.php is available here http://codex.gallery2.org/Gallery3:Themes:greydragon as Hotfix20091002-2.zip
Posts: 31
I am going to put it into my theme to.
So far I looked and it looks nice (much better as my quick solution)
I will update once I have the results.
Posts: 22890
Please look at recent changes to pagination:
http://github.com/gallery/gallery3/commit/081ce9f6ca07b834fd31d3d340990504dd68f821
&
http://github.com/gallery/gallery3/commit/29efb6ba9f3e2cf15f29b509f985890c33bc08fa
New ways of pagination, documented in the files for theme developers.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team