Advertisement:

Author Topic: Pages: << [1] 2 3 ... 45 >>  (Read 4782 times)

houtsma

  • Guest
Pages: << [1] 2 3 ... 45 >>
« on: August 21, 2004, 01:22:04 PM »
I would like to see two extra buttons (<< and >>) to move to the previous or following
subpage in a topic. The current Next and Previous buttons move to the corresponding
Topics instead, which is something i am not used to.

Thanks,
Jan

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Pages: << [1] 2 3 ... 45 >>
« Reply #1 on: August 21, 2004, 04:13:52 PM »
Actually, those are in a completely different part of the screen, to signify that they are not related to the page listing.

Have you tried changing your contiguous pages settings?

-[Unknown]

houtsma

  • Guest
Re: Pages: << [1] 2 3 ... 45 >>
« Reply #2 on: August 22, 2004, 04:48:49 AM »
Yes i know it's a different part of the screen and i don't argue them. Just that
they are more or less "near" the pages buttons (on a small screen the difference
is small). But having "<<' and ">>" buttons would even take that doubt away.

In the contiguous page settings i can switch it on, off or select a different
layout (1 ... 4 [5] 6 ... 9 or 1 ... 3 4 [5] 6 7 ... 9) but none of them will allow
me to press some "next sub-page" button, like the "next-topic" button.

Look for example at phpbb or other boards. Not that smf should try to duplicate
the other boards but this is one feature iwhich in my opinion is really handy!

Talking about another phpbb feature i miss, see:
     http://www.simplemachines.org/community/index.php?topic=15617.0

Thanks. smf is great software though!

jan
« Last Edit: August 22, 2004, 04:55:13 AM by houtsma »

Offline admactanium

  • Semi-Newbie
  • *
  • Posts: 96
Re: Pages: << [1] 2 3 ... 45 >>
« Reply #3 on: November 18, 2004, 03:32:19 AM »
new here so sorry to bring up an old topic. but i agree with the original poster here. i would like to see either "<<" and ">>" or "previous" & "next" or image buttons surrounding the contiguous pages. it's easier to hit a bigger target than to hit a single digit. also, it tends to make the designer want to make the page numbers really large to make the target easier to hit (which seems a bit too big).

great stuff here. love the board but that's the one small but significant thing i'd like to see added.

Offline A.M.A

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 2,133
  • Gender: Male
  • ..
Re: Pages: << [1] 2 3 ... 45 >>
« Reply #4 on: November 18, 2004, 04:08:48 AM »
That method is already used for wireless browsing .. if you need it just add/replace
this:
Code: [Select]
' . (!empty($context['links']['prev']) ? '<a href="' . $context['links']['first'] . '">First</a> <a href="' . $context['links']['prev'] . '">previous</a> ' : '') . '(' . $context['page_info']['current_page'] . '/' . $context['page_info']['num_pages'] . ')' . (!empty($context['links']['next']) ? ' <a href="' . $context['links']['next'] . '">next</a> <a href="' . $context['links']['last'] . '">Last</a> ' : '') . 'or this:
Code: [Select]
' . (!empty($context['links']['prev']) ? '<a href="' . $context['links']['first'] . '">&lt;&lt;</a> <a href="' . $context['links']['prev'] . '">&lt;</a> ' : '') . '(' . $context['page_info']['current_page'] . '/' . $context['page_info']['num_pages'] . ')' . (!empty($context['links']['next']) ? ' <a href="' . $context['links']['next'] . '">&gt;</a> <a href="' . $context['links']['last'] . '">&gt;&gt;</a> ' : '') . '
to/with Display.template.php
Code: [Select]
', $context['page_index'];two times.
« Last Edit: November 18, 2004, 04:12:19 AM by A.M.A »
Really sorry .. real life is demanding my full attention .. will be back soon hopefully :)

Offline admactanium

  • Semi-Newbie
  • *
  • Posts: 96
Re: Pages: << [1] 2 3 ... 45 >>
« Reply #5 on: November 20, 2004, 08:34:10 PM »
sorry to be dense ama, but how exactly do i do this? i didn't understand your post.

open display.template.php

and find this:
Code: [Select]
', $context['page_index'];
and put this below it:
Code: [Select]
' . (!empty($context['links']['prev']) ? '<a href="' . $context['links']['first'] . '">First</a> <a href="' . $context['links']['prev'] . '">previous</a> ' : '') . '(' . $context['page_info']['current_page'] . '/' . $context['page_info']['num_pages'] . ')' . (!empty($context['links']['next']) ? ' <a href="' . $context['links']['next'] . '">next</a> <a href="' . $context['links']['last'] . '">Last</a> ' : '') . '
?

what is the "two times." referring to?

thanks.

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Pages: << [1] 2 3 ... 45 >>
« Reply #6 on: November 21, 2004, 01:33:58 AM »
He wants you to find some block of code, which will appear in two places of Themes/yourtheme/Display.template.php, and both times you find it replace it with another block of code.

-[Unknown]

Offline admactanium

  • Semi-Newbie
  • *
  • Posts: 96
Re: Pages: << [1] 2 3 ... 45 >>
« Reply #7 on: November 21, 2004, 10:53:14 PM »
thank you unknown. i will attempt that change.

Offline admactanium

  • Semi-Newbie
  • *
  • Posts: 96
Re: Pages: << [1] 2 3 ... 45 >>
« Reply #8 on: November 22, 2004, 05:35:39 AM »
hmm. so i copied the first line exactly into line 170 of the display.template.php file in my theme. i replaced the line:

Code: [Select]
', $context['page_index'];
with this line:

Code: [Select]
' . (!empty($context['links']['prev']) ? '<a href="' . $context['links']['first'] . '">First</a> <a href="' . $context['links']['prev'] . '">previous</a> ' : '') . '(' . $context['page_info']['current_page'] . '/' . $context['page_info']['num_pages'] . ')' . (!empty($context['links']['next']) ? ' <a href="' . $context['links']['next'] . '">next</a> <a href="' . $context['links']['last'] . '">Last</a> ' : '') . '
and my browser returned this error:

Quote
Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /home/jeffnee/public_html/scar/forum/Themes/scarface/Display.template.php on line 170

i tried to find out where the missing "," or ";" should go but i'm just guessing.

Offline Grudge

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 10,742
  • Gender: Male
  • Unofficial nuisance
Re: Pages: << [1] 2 3 ... 45 >>
« Reply #9 on: November 22, 2004, 05:39:06 AM »
That line should be:
Code: [Select]
' . (!empty($context['links']['prev']) ? '<a href="' . $context['links']['first'] . '">First</a> <a href="' . $context['links']['prev'] . '">previous</a> ' : '') . '(' . $context['page_info']['current_page'] . '/' . $context['page_info']['num_pages'] . ')' . (!empty($context['links']['next']) ? ' <a href="' . $context['links']['next'] . '">next</a> <a href="' . $context['links']['last'] . '">Last</a> ' : '');
When used in the place that you mentioned
I'm only a half geek really...

Offline V@no

  • Jr. Member
  • **
  • Posts: 118
  • mmm PHP...
Re: Pages: << [1] 2 3 ... 45 >>
« Reply #10 on: March 24, 2005, 12:27:05 AM »
Thanks guys for the code!
Works great.

And here is exactly what hautsma wanted:
Code: [Select]
' . (!empty($context['links']['prev']) ? '<a href="' . $context['links']['first'] . '">&lt;&lt;</a> <a href="' . $context['links']['prev'] . '">&lt;</a> ' : '') . $context['page_index'] . (!empty($context['links']['next']) ? ' <a href="' . $context['links']['next'] . '">&gt;</a> <a href="' . $context['links']['last'] . '">&gt;&gt;</a> ' : '');

Offline V@no

  • Jr. Member
  • **
  • Posts: 118
  • mmm PHP...
Re: Pages: << [1] 2 3 ... 45 >>
« Reply #11 on: October 18, 2009, 09:27:18 PM »
I know it's very old topic, but since then came up a better solution that is theme-independent.

In Sources/Subs.php find:
Code: [Select]
return $pageindex;
Insert above:
Code: [Select]
// First/Prev
if ($start != 0)
$pageindex = sprintf($base_link, 0, '&#171;&#171;') . ((empty($modSettings['compactTopicPagesEnable'])) ? "" : " " . sprintf($base_link, $start - $num_per_page, '&#171;')) . $pageindex;

// Next/Last
$tmpMaxPages = (int) (($max_value - 1) / $num_per_page) * $num_per_page;
if ($tmpMaxPages >= $start + $num_per_page)
$pageindex .= ((empty($modSettings['compactTopicPagesEnable'])) ? "" : sprintf($base_link, (($start + $num_per_page) > $max_value ? $max_value : ($start + $num_per_page)), '&#187;') . " ") . sprintf($base_link, $tmpMaxPages, '&#187;&#187;');