Customizing SMF > Modifications and Packages

Previous and Next Links for Page Index

<< < (3/7) > >>

live627:
Shows "Next" in the message index. Doesn't seem like expected behavior... so I'm reporting it.

live627:
These edits will fix the issue:

./Sources/Subs.php


--- Code: (Find) ---function constructPageIndex($base_url, &$start, $max_value, $num_per_page, $flexible_start = false)
--- End code ---


--- Code: (Replace with) ---function constructPageIndex($base_url, &$start, $max_value, $num_per_page, $flexible_start = false, $show_prev_next = true)
--- End code ---


--- Code: (Find) ---$pageindex = sprintf($base_link, $tmpStart, $txt['prev page']);
--- End code ---


--- Code: (Replace with) ---if ($show_prev_next) $pageindex = sprintf($base_link, $tmpStart, $txt['prev page']);
--- End code ---


--- Code: (Find) ---$pageindex = sprintf($base_link, $tmpStart, $txt['next page']);
--- End code ---


--- Code: (Replace with) ---if ($tmpStart <= $tmpMaxPages && $show_prev_next) $pageindex = sprintf($base_link, $tmpStart, $txt['next page']);
--- End code ---

./Sources/MessageIndex.php


--- Code: (Find) ---$pages .= constructPageIndex($scripturl . '?topic=' . $row['id_topic'] . '.%1$d', $start, $row['num_replies'] + 1, $context['messages_per_page'], true, false);
--- End code ---


--- Code: (Replace with) ---$pages .= constructPageIndex($scripturl . '?topic=' . $row['id_topic'] . '.%1$d', $start, $row['num_replies'] + 1, $context['messages_per_page'], true, false);
--- End code ---

Firia:
Thanks for the fix, live627! I had some trouble with two of your changes, so this is what worked for me (I made these changes after installing the modification):

First two changes in ./Sources/Subs.php were fine.

For the third change in ./Sources/Subs.php, I did instead:


--- Code: (find) ---if ($tmpStart <= $tmpMaxPages) $pageindex .= sprintf($base_link, $tmpStart, $txt['next page']);
--- End code ---


--- Code: (replace with) ---if ($tmpStart <= $tmpMaxPages && $show_prev_next) $pageindex .= sprintf($base_link, $tmpStart, $txt['next page']);
--- End code ---


For ./Sources/MessageIndex.php, I did instead:


--- Code: (find) ---$pages .= constructPageIndex($scripturl . '?topic=' . $row['id_topic'] . '.%1$d', $start, $row['num_replies'] + 1, $context['messages_per_page'], true);
--- End code ---


--- Code: (replace with) ---$pages .= constructPageIndex($scripturl . '?topic=' . $row['id_topic'] . '.%1$d', $start, $row['num_replies'] + 1, $context['messages_per_page'], true, false);
--- End code ---

Also thanks to phpmycoder for the original modification :]

phpmycoder:
Sorry for late reply, I subscribed here with an email I hardly check anymore, but should attend often now.

v2.1:
- Fixed the issue above by adding !$start_invalid condition.
- Beautified code (just for show, no practical implication).
- All changes still only in Subs.php

If there's any new or old problems popping up please let me know and I will try to attend asap.

All the best,
Gigi

bknysnake:
Hi I've been having a problem with this mod, I've installed it via the admin/package manager. and I noticed no options for it, nor was it showing on any pages as if it was working. So I removed it assuming it isn't working, after I removed it, I realized that my font size has increased and now at the top of the page you can see "// PreviousNextPage links $txt['prev page'] = 'Prev'; $txt['next page'] = 'Next';" So I proceed to see if installing and uninstalling it again would work, but no luck, instead, it shows that msg twice on the top of my page. If you'd like to have a look, check famcraft.com I'm no type of coder, I'm fairly new to all of this, but I believe this can be a bug when installing it through the package manager, any help you guys can give me to fix this issue? Thanks in advance.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version