View Issue Details

IDProjectCategoryView StatusLast Update
4542Composrwikipublic2024-11-03 21:44
Reportermythus Assigned ToGuest  
PrioritynormalSeverityfeature 
Status newResolutionopen 
Summary4542: Previous, Up, Next Wiki Page Links/Buttons
DescriptionSo, I have this problem.... I have a large wiki with lots of categories and lots of pages in said categories. When I go into a category to look at a page, I sometimes want to go to the next page following it. Or sometimes to the previous page. To do so, I typically have to go back to the gategory tree listing and click on the next page there. What I propose is to have a set of buttons at the bottom of the page. These buttons would go to the previous page or next page in the tree listing order. The Up button would bring you to the front page of the category. This would help with navigating wiki pages and taking in information listed there.

Ideally it should be a dynamic box that the website designer could add to the bottom of the page (or top if desired I guess), much like the table of contents.
Steps To ReproduceTry checking out my site wiki just to see why I'd want this...?
Additional InformationThis is ideal for a Wiki, but it could also be useful for catalogues.
TagsHas Patch, Roadmap: Over the horizon
Attach Tags
Attached Files
set_nav.diff (24,234 bytes)   
Time estimation (hours)2
Sponsorship open

Sponsor

Date Added Member Amount Sponsored

Relationships

related to 2076 Not AssignedGuest Horizontal swiping on mobile mode 

Activities

Chris Graham

2021-01-03 03:33

administrator   ~6888

I was feeling generous, and new features aren't going to be considered any time soon, so here's a block that does what you want.

For it to just go horizontally across parents of the same parent category:
[block multi_level="0"]wiki_nav[/block]

For it to do full tree traversal:
[block multi_level="1"]wiki_nav[/block]

Or you can put it in the WIKI_PAGE_SCREEN.tpl template like:
{$BLOCK,block=wiki_nav,multi_level=1}

Full tree traversal is less efficient as it has to load the whole tree, but I did cache the tree so it shouldn't be too bad. That's why there's an upon_query hook, to flush out the cached tree if the Wiki+ tree is changed.

The block looks at the current ID in the URL to see where the user is currently at. So it only is going to work when used directly within Wiki+. Not that you'd want to place it outside of Wiki+.
wiki_nav.zip (2,076 bytes)

Guest

2021-01-03 03:59

reporter   ~6889

You are absolutely awesome Chris. Do you have a "buy me a beer" function yet? I am glad to see it as a block, TBH. That makes it all the more versitile IMO. I of course just went and put it in the TPL, dressed it up in a div so I could center it.

It works, of course. The odd thing is the back and forward seem to be going based on page name in alphabetical order, instead of ID #, despite looking at your php code and I swear you have it wrote to go by ID #. No biggie though, it still works for what I want it to do. Maybe I can brush off an old php book and learn a little if it bothers me too much. It is at least keeping the pages in their categories.

Thanks again Chris, you rock.

Chris Graham

2021-01-03 04:09

administrator   ~6890

Here's my Patreon if you like:
https://www.patreon.com/composr

It's ordering by the the_order field in the wiki_children table.
I am wondering if somehow that field became defunct intentionally, or if I forgot - because I can't see it being used in the code.

I'll take a look tomorrow.

Chris Graham

2021-01-03 16:46

administrator   ~6892

Last edited: 2021-01-03 16:46

Ok, so it's not meant to be ID order, it's meant to be the the_order field, which is different from any IDs.

And it's not, because of a bug in the sitemap code I just found, hot-fix in this issue:
https://compo.sr/tracker/view.php?id=4546

The block code did use the_order, but that was only actually in effect if multi_level=0.

Chris Graham

2021-01-03 16:47

administrator   ~6893

Oh and the block cache needs emptying after applying that hotfix.

mythus

2021-01-04 00:53

developer   ~6894

It works beautifully sir. Thank you so much!

Chris Graham

2021-03-15 18:49

administrator   ~7016

Last edited: 2023-02-21 02:01

I made a Composr-wide implementation of next/previous for a client, and have a patch. I haven't compared to this issue, but there is a lot of similarity. I've tagged this issue as v12, although I'm more thinking about the patch I made for the client than what I posted here as I like the idea of a consistent out-of-the-box Composr-wide solution that also supports mobile swiping (2076).

EDIT: Patch is now outdated, would need refreshing.

mythus

2024-11-03 21:44

developer   ~9556

Just to update this no longer works in Composr v11

Add Note

View Status
Note
Upload Files
Maximum size: 32,768 KiB

Attach files by dragging & dropping, selecting or pasting them.
You are not logged in You are not logged in. This means you will not get any e-mail notifications. And if you reply, we will not know for sure you are the original poster of the issue.

Issue History

Date Modified Username Field Change
2021-01-02 01:04 mythus New Issue
2021-01-03 03:33 Chris Graham File Added: wiki_nav.zip
2021-01-03 03:33 Chris Graham Note Added: 0006888
2021-01-03 03:59 Guest Note Added: 0006889
2021-01-03 04:09 Chris Graham Note Added: 0006890
2021-01-03 16:46 Chris Graham Note Added: 0006892
2021-01-03 16:46 Chris Graham Note Edited: 0006892
2021-01-03 16:47 Chris Graham Note Added: 0006893
2021-01-04 00:53 mythus Note Added: 0006894
2021-03-15 18:47 Chris Graham Tag Attached: Roadmap: v12
2021-03-15 18:48 Chris Graham Relationship added related to 2076
2021-03-15 18:49 Chris Graham Note Added: 0007016
2021-07-30 20:46 Chris Graham Time estimation (hours) => 2
2021-11-01 20:12 Chris Graham Tag Attached: Has Patch
2021-11-02 03:38 Chris Graham File Added: set_nav.diff
2021-11-03 01:25 Chris Graham File Deleted: set_nav.diff
2021-11-03 01:25 Chris Graham File Added: set_nav.diff
2023-02-21 02:01 Chris Graham Note Edited: 0007016
2024-03-26 00:58 PDStig Tag Renamed Roadmap: v12 => Roadmap: Over the horizon
2024-11-03 21:44 mythus Note Added: 0009556