Help with Next / Previous Page Navigation

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Help with Next / Previous Page Navigation

mgoetze
Hi Nabble Team,
We would like to add Next and Previous navigation buttons to our message threads.  See the image below for an example.  (circled in orange). It would be nice to have the option of using a graphic button, but worse case we could simply use text.    Can you please tell us how we can accomplish this using NAML or other approach.



Thank you,
Mark
Reply | Threaded
Open this post in threaded view
|

Re: Help with Next / Previous Page Navigation

Pedro <Nabble>
Please, add this code in your advanced naml editor:
<override_macro name="topic_controls_right" requires="forum_topic_namespace">
    <n.pin_icon/>
    <n.lock_icon/>
    <n.message_count/>
    <img src="/images/gear.png" class="image16" alt="[t]Options[/t]"/>
    <n.page_node.topic_dropdown/>
    <n.comment.>Added Prev and next topic links</n.comment.>
    <n.prev_topic/> |
    <n.next_topic/>
</override_macro>

<macro name='next_topic'>
    <n.page_node.get_app_node.children_list. start="[n.app_index_record/]"
            length="[n.app_rows_per_page/]"
            filter="[n.app_topic_filter/]"
    sort="[n.if.app_is_by_priority][then]priority[/then][else]pinned-and-last-node-date[/else][/n.if.app_is_by_priority]" >
        <n.comment.>Added Next Topic links</n.comment.>
        <n.loop.>
            
            <n.if.equal value1="[n.current_node.id/]" value2="[n.page_node.id/]">                
                <then>
                    <n.if.next_node>
                        <then>
                            <a href="[n.current_node.url/]">Next Topic</a>
                        </then>
                        <else>
                            <t>Next Topic</t>
                        </else>
                    </n.if.next_node>                        
                </then>  
            </n.if.equal>
            
        </n.loop.>
    </n.page_node.get_app_node.children_list.>
</macro>

<macro name='prev_topic'>
    <n.page_node.get_app_node.children_list. start="[n.app_index_record/]"
    length="[n.app_rows_per_page/]"
    filter="[n.app_topic_filter/]"
    sort="[n.if.app_is_by_priority][then]priority[/then][else]pinned-and-last-node-date[/else][/n.if.app_is_by_priority]" >
        <n.comment.>Added Prev Topic link</n.comment.>
        <n.loop.>         
            <n.if.equal value1="[n.current_node.id/]" value2="[n.page_node.id/]">                   
                <then>  
                      <a href="[n.var name='last_url'/]">Prev Topic </a>       
                </then>  
            </n.if.equal>
            <n.set_var. name='last_url'><n.current_node.url/></n.set_var.>           
        </n.loop.>
    </n.page_node.get_app_node.children_list.>
</macro>
Let me know if it works, so that we can customize.
My test forum.
Reply | Threaded
Open this post in threaded view
|

Re: Help with Next / Previous Page Navigation

mgoetze
This post was updated on .
Pedro,
Two things (see graphic below):
1. I was actually looking for a way to add buttons to move to the next/previous page of messages, NOT topics.  I know we already have the page numbers, but I would like to give our customers a basic forward or back arrow; many find this easier than clicking on the numbers.  I think a graphic will be better than text so that they dont confuse it with the topics next/previous links above.  See my mockup below, we can do something like this (we can provide the graphics).   There is a little intelligence we would have to add - Notice in image #1 that only the Next arrow shows (because there is not previous page), notice in image #2 that both previous and next arrows show (because you can now go back or forward, and finally notice in image #3 that only the back arrow shows (because you are at the last page)

2. I like your previous and next topic code.  I did find an error however.   See in image #2 and #3 below. the words "Prev Topic | Next Topic" do not appear once you go beyond one page.    

Reply | Threaded
Open this post in threaded view
|

Re: Help with Next / Previous Page Navigation

Pedro <Nabble>
Please, try this code:
<override_macro name="generic_paging" requires="paging" parameters="margin,url">
    <n.if.has_paging>
        <then>
            <n.put_in_head.>
                <style type="text/css">
                    span.current-page { padding: .1em .4em; }
                    span.page { padding: .1em; }
                    span.pages a { padding: .1em .4em; }
                    span.current-page { border-width:1px; border-style:solid; }
                    span.pages {
                    float:right;
                    white-space:nowrap;
                    font-weight:normal;
                    }
                </style>
            </n.put_in_head.>           
            <span class="pages" style="padding:[n.margin/]">
                <n.if.has_next_page>
                    <then>
                        <a href="[n.current_page.next_page.url/]">Next &raquo;</a>
                    </then>
                </n.if.has_next_page>
            </span>
            <n.remove_spaces_between_tags.>
                <span class="pages" style="padding:[n.margin/]">
                    <n.if.not.is_at_beginning>
                        <then>
                            <n.first_page.link url="[n.url/]" /> ...
                        </then>
                    </n.if.not.is_at_beginning>
                    <n.neighboring_pages.show url="[n.url/]" />
                    <n.if.not.is_at_end>
                        <then>
                            ... <n.last_page.link url="[n.url/]" />
                        </then>
                    </n.if.not.is_at_end>
                </span>
            </n.remove_spaces_between_tags.>
            <span class="pages" style="padding:[n.margin/]">
                <n.if.has_previous_page>
                    <then>
                        <a href="[n.current_page.previous_page.url/]">&laquo; Prev </a>
                    </then>
                </n.if.has_previous_page>
            </span>           
        </then>
    </n.if.has_paging>
</override_macro>
My test forum.
Reply | Threaded
Open this post in threaded view
|

Re: Help with Next / Previous Page Navigation

mgoetze
Works great.  Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: Help with Next / Previous Page Navigation

Coleen_Astalos
In reply to this post by Pedro <Nabble>
Piggy Backing on this topic.  Would something like this be possible for the Prev / Next Topics?  The same problem exists on page 2, 3, etc. of the list of topics - the Prev Topic and Next Topic aren't there.  It only currently works for the first page worth of topics.
Coleen
Reply | Threaded
Open this post in threaded view
|

Re: Help with Next / Previous Page Navigation

Pedro <Nabble>
Please, change your both macros prev_topic , next_topic. You should replace your code with this:
    <n.page_node.get_app_node.children_list. start="0"
    length="[n.app_rows_per_page/]"
    filter="[n.app_topic_filter/]"
    sort="[n.if.app_is_by_priority][then]priority[/then][else]pinned-and-last-node-date[/else][/n.if.app_is_by_priority]" >
In both macros the "start" attribute should be 0.

Let me know if it works.
My test forum.
Reply | Threaded
Open this post in threaded view
|

Re: Help with Next / Previous Page Navigation

Coleen_Astalos
No, I still don't see the Next Topic / Prev Topic links when I'm on page 2 or higher in the list of topics in a subforum.
Coleen
Reply | Threaded
Open this post in threaded view
|

Re: Help with Next / Previous Page Navigation

Pedro <Nabble>
Please, give a topic where the links don't appear at page 2 or higher.
My test forum.
Reply | Threaded
Open this post in threaded view
|

RE: Help with Next / Previous Page Navigation

Coleen_Astalos

All of them starting on page 2.  But here is one: http://forum.sudsol.org/Fall-Fest-td13009.html

 

What would really be nice is to start anywhere, select a topic and be able to continue to scroll forward or backwards through the topics regardless of page boundaries. 

-Coleen

 

Coleen Astalos, Stampin' Up! Demonstrator
Alamosa, CO, [hidden email]
See my website at http://alamosa.stampinup.net
Are you a demonstrator? Join me on SUDSOL - Your 24/7 Upline!

 

From: Pedro <Nabble> [via Nabble Support] [mailto:[hidden email]]
Sent: Friday, September 5, 2014 4:21 AM
To: Coleen_Astalos
Subject: Re: Help with Next / Previous Page Navigation

 

Please, give a topic where the links don't appear at page 2 or higher.

My test forum.

 


If you reply to this email, your message will be added to the discussion below:

http://support.nabble.com/Help-with-Next-Previous-Page-Navigation-tp7591233p7591338.html

To unsubscribe from Help with Next / Previous Page Navigation, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

RE: Help with Next / Previous Page Navigation

Pedro <Nabble>
Thanks, now I see.
I've made some changes in your forum. Please, take a look.
My test forum.
Reply | Threaded
Open this post in threaded view
|

RE: Help with Next / Previous Page Navigation

Coleen_Astalos

Perfect.  Thanks!

Coleen

 

Coleen Astalos, Stampin' Up! Demonstrator
Alamosa, CO, [hidden email]
See my website at http://alamosa.stampinup.net
Are you a demonstrator? Join me on SUDSOL - Your 24/7 Upline!

 

From: Pedro <Nabble> [via Nabble Support] [mailto:[hidden email]]
Sent: Monday, September 8, 2014 5:16 AM
To: Coleen_Astalos
Subject: RE: Help with Next / Previous Page Navigation

 

Thanks, now I see.
I've made some changes in your forum. Please, take a look.

My test forum.

 


If you reply to this email, your message will be added to the discussion below:

http://support.nabble.com/Help-with-Next-Previous-Page-Navigation-tp7591233p7591369.html

To unsubscribe from Help with Next / Previous Page Navigation, click here.
NAML