Navigate from Topic to Topic?

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

Re: Navigate from Topic to Topic?

GregChapman
Thanks Pedro,

I've played around a little. I now have Previous and Next links showing on all apps.

I now need help in editing the code further.  When you click "Next Topic" continually and reach the final topic the next link then disappears. (That's as I would like it.)

However, when you click the "Prev Topic" link continually and reach the first topic, the text merely loses the link. What change should be made to make the text disappear as well.

Once I have that working I will remove the topic links from everything but the gallery and then I want to replace the text links with graphic arrows. (Those used when scrolling through the gallery images on the root "Mixed" application, found at:
http://seahawk-forum.968426.n3.nabble.com/images/right.png
)

Can you help with either of these changes?
Volunteer Helper - but recommending that users move off the platform!
Once the admin for GregHelp now deleted.
Reply | Threaded
Open this post in threaded view
|

Re: Navigate from Topic to Topic?

Coleen_Astalos
GregChapman wrote
However, when you click the "Prev Topic" link continually and reach the first topic, the text merely loses the link. What change should be made to make the text disappear as well.
When you figure that out, let me know because in mine I want the Next Topic text (just not as an active link) - because I put a seperator between the Prev_Topic and Next Topic links and it looks funny to see the Prev_Topic then the seperator  with nothing after it. Although this is VERY LOW on my priority list - would rather get the two bugs (No Digest issued for New Topics and trucation of email reply that contains a link or picture) fixed first.
Coleen
Reply | Threaded
Open this post in threaded view
|

Re: Navigate from Topic to Topic?

Pedro
In reply to this post by GregChapman
Please, take a look at next_topic and prev_topic. There are everything related to these links.
If you have any issues I will try to help you later. We have to fix those bugs Coleen said.
My test forum.
Reply | Threaded
Open this post in threaded view
|

Re: Navigate from Topic to Topic?

Coleen_Astalos
I fixed mine (Next_Topic) - just added an else statement to print Next Topic if there isn't a next topic.

Greg, I think you can fix yours in prev_topic by adding an If check around the line:
<a href="[n.var name='last_url'/]">Prev Topic      
to see if there is a previous node (similar to what is done in the Next Node code).            

I just don't know what the if check should be - perhaps that node_id=1?
Coleen
Reply | Threaded
Open this post in threaded view
|

Re: Navigate from Topic to Topic?

Pedro
In order to deal with "next topic" at the last topic of a page, merge or replace your macros with it:
<macro name='prev_topic'>
    <n.page_node.get_app_node.children_list. start="0" length="1000"
    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.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>
                    <n.break/>                  
                </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>

<macro name='next_topic'>
    <n.page_node.get_app_node.children_list. start="0" length="1000"
            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.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>
                            <n.break/>    
                        </then>
                    </n.if.next_node>                         
                </then>  
            </n.if.equal>            
        </n.loop.>
    </n.page_node.get_app_node.children_list.>
</macro>
Greg, you can add your narrow image inside "a" tags, replacing the texts "Next Topic" and "Prev Topic".
My test forum.
Reply | Threaded
Open this post in threaded view
|

Re: Navigate from Topic to Topic?

GregChapman
Hi Pedro,

I tried that code, but it functions as before:

a) After pressing "Next Topic" repeatedly, the text disappears when I reach the last topic.

b) After pressing "Prev Topic" repeatedly, the link disappears but the text remains when I reach the first topic.

I want both directions to behave like a), so that when I replace the text with a graphic I won't have an unclickable arrow showing.

( If I understood right Coleen's solution would make both behave like b). )
Volunteer Helper - but recommending that users move off the platform!
Once the admin for GregHelp now deleted.
Reply | Threaded
Open this post in threaded view
|

Re: Navigate from Topic to Topic?

Coleen_Astalos
No, the solution I stated (to add an If check to prev_topic macro to see if there is a previous topic before printing the Prev_Topic link) would make both previous & next to work like a - the way you want.

I've got mine working the way I want (b) by changing the next_topic macro to include an else on that if check in the next_topic macro to print "Next_Topic"

Coleen
Reply | Threaded
Open this post in threaded view
|

Re: Navigate from Topic to Topic?

GregChapman
Can you remind me of your forum's URL so I can take a look, or post the code.

Like Harvey, I still haven't got my head around enough of NAML's syntax (There's too many dots!), and most of the time I can still only say "Of course!" once I have seen a working example.

I understand the theory of "wrap it in an if clause", but it's getting the proper syntax that I haven't come to terms with.

(I guess I need to spend some time reading up on "objects" and "methods" which seemed to be the jargon used some 15 years ago. Think of me as still of the:

10 CLS
20 x=1
30 PRINT x
40 x=x+1
50 IF x=11 GOTO 70
60 GOTO 30
70 END

vintage of programmers! )
Volunteer Helper - but recommending that users move off the platform!
Once the admin for GregHelp now deleted.
Reply | Threaded
Open this post in threaded view
|

Re: Navigate from Topic to Topic?

Coleen_Astalos
I've attached both of MY (which "Implements Option A") prev_topic and next_topic posts to this post (I can't insert them here or it wants to take the HTML and use it - not sure how Pedro does that)

Prev_Topic:
prev_topic.txt
Next_topic:
next_topic.txt

I played around and I think I've got it for you.  Update your "Prev_Topic" to this:
Greg-prev_topic.txt 

Which just added this if check around the Prev Topic link to see if it was the first message
         <n.if.equal value1="[n.page_node.id/]" value2="1">
                <then>
                 <a href="[n.var name='last_url'/]">Prev Topic        
                </then>
        </n.if.equal>

Coleen
Reply | Threaded
Open this post in threaded view
|

Re: Navigate from Topic to Topic?

Coleen_Astalos
Oops.  Spoke too soon now you never get the "Prev_Topic" link.  

It's the right idea though, but I don't know what you should be checking to see if it's the first topic in the list.  

Coleen
Reply | Threaded
Open this post in threaded view
|

Re: Navigate from Topic to Topic?

Coleen_Astalos
Checking the Node_id didn't work because it's not a one up number from one for each topic.  

This may be getting closer, but still isn't quite there (checking to see if the last_url is null)

      <n.if.not.is_null value="n.var name='last_url'/">   
             <then>
                   <a href="[n.var name='last_url'/]">Prev Topic        
            </then>
     </n.if.not.is_null>     

Apparently the last_url isn't null if there isn't one.  So I tried checking to see if it was blank (tried with a space as well as nothing between the quotes) like this:

     <n.if.not.equal value1="[n.var name='last_url'/]" value2=" ">    
        <then>
       <a href="[n.var name='last_url'/]">Prev Topic        
      </then>
    </n.if.not.equal>        

Nope.  I also tried to print the value of last_url to see what the value WAS.  But then I get a 500 error when I nagivate to the first post in the topic.

No luck.  I'm out of ideas.  But I had fun trying!  Reminds me of my old programmer days.

Coleen
Reply | Threaded
Open this post in threaded view
|

Re: Navigate from Topic to Topic?

Pedro
The code I gave was to avoid the "Next Topic" link disappear when the topic is the last in a pagination. Or the "Prev Topic" when the topic was the first of the second pagination. Maybe you forgot or didn't notice this bug.
There was nothing to do with display off the text "Next Topic" or deactivate the link. That's why I told you to merge that with your code.
My test forum.
Reply | Threaded
Open this post in threaded view
|

Re: Navigate from Topic to Topic?

Coleen_Astalos
Pedro,
I don't know if this response was for me or Greg.  Mine is working just the way I want it.  I was just trying to help get Greg so that he didn't have the Prev_Topic link on the first topic like he wants.
Coleen
12