Tags:
create new tag
view all tags

SID-01796: Determining previous topic name, and hyperlink nickname

Status: Answered Answered TWiki version: Perl version:
Category: Server OS: Last update: 12 years ago

In a topic, I would like to base conditional text on the nickname of the hyperlink that a user follows to get to the topic.

I haven't seen this defined.

Is there a variable that contains the nickname (not the topic wikiname) of the hyperlink to a topic?

Another useful detail may be the topic wikiname or URL of the topic that a user was previously in before going to a topic.

Is there a variable for that?

I've seen a text reference to a "History Plugin", but have not been able to find any substance to it.

Is there a History Plugin? If so, where are the devilish details?

Thanks Folks,

-- Patrick Townsend-Wells - 2013-09-09

Discussion and Answer

What do you mean by nickname? If you mean link label you can use the double-square bracket rule.

The upcoming TWiki supports topic titles, see ShowTopicTitleInLinks.

There is currently no support to show the "path traveled" to the current topic. TWiki does however support parent-child relationship, and with this a "path home" breadcrumb.

-- Peter Thoeny - 2013-09-09

I am referring to the optional label in a link [[TopicTWikiName][Topic Nickname]].

- After a user navigates via a link to a topic, does the TWiki application store the topic nickname of the link in a "previous topic nickname" variable? Can an IF command in the topic use that variable setting as the IF's condition to control the rendering of topic content? It would be even better if this variable stored the topic nickname when the link contains the optional label, and the variable would store the topic TWiki name if the link didn't contain the optional label.

- If this can be done, complex webs that contain "master topics" could be supported in order to reduce the number of actual topics and the number of unique links in the web.

- It would also be highly useful to be able to clone (copy) a topic that takes all links in the web to the original topic and updates them to the new topic.

-- Patrick Townsend-Wells - 2013-09-10

Ah, what you call "nickname" is the link label in a square bracket link.

There is no way to find out the link label in the destination topic after clicking on a link. Even if you do that it is possible to have different link labels for the same topic, so you would have inconsistencies.

I do not understand your use case. I recommend you look into parameterized includes and parameterized variables if you want to have dynamic content in a topic, controlled by another topic:

-- Peter Thoeny - 2013-09-10

Thanks for the info.

I'm trying to translate a simple type of document, an API reference, into a TWiki document. A web contains the entire document. Each topic is typically, but not always, a single page of the document.

If the current topic can determine the topic display name of the previous topic, "master topics" that reduce the number of topics in the web could be supported. A "master topic" is a single topic that appears to the user as many different document pages ("apparent topics"). Unconditional content in the master would be common to all of its "apparent topics" Multiple IF statements would control the text that is unique to a single "apparent topic."

The web would contain many "master topics" that the user would ACTUALLY navigate among. From the user's perspective, they would be navigating among "apparent topics." Therefore, the WikiWord topic name is not very useful because it specifies a collection of "apparent topics" that the user is presented with. It is the topic display name that is useful.

Of course, INCLUDE statements can be used to reproduce common text from a "master topic" into many other REAL topics. However, this requires many more topics in the web.

Is it possible to store the topic display name of the previous topic (probably via the link information) in a parameterized variable (or anything else), and can that be used in the code of the current topic?

I will check this out in your links above.

Thanks again,

-- Patrick Townsend-Wells - 2013-09-10

In the current topic, can the topic display name in a parameter whose setting persists across linking to another topic? Can the newly current topic then use that parameter setting as a condition?

-- Patrick Townsend-Wells - 2013-09-10

Can a SET command be put inside a link?

-- Patrick Townsend-Wells - 2013-09-10

Can code be inserted into a topic that: - Looks like a link when rendered (topic display name). - Is activated when the user clicks on the apparent link. - Sets a parameter that persists across linking. - Finally links to a specified topic.

-- Patrick Townsend-Wells - 2013-09-10

You could add a URL parameter to your link, and then use that information once a user clicks on the link. You have to construct the full URL if you want to add URL parameters. So, instead of [[SomeTopic][link label]] link you write [[%SCRIPTURL{view}%/%WEB%/OtherTopic?foo=%ENCODE{some text}%][link label]]. In the OtherTopic you can display the value of the foo using %URLPARAM{foo}%.

See VarENCODE, VarURLPARAM

-- Peter Thoeny - 2013-09-10

Here's the crucial question:

Is it possible to set a variable in one topic, and then navigate to another topic and use that variable? So far, I have been unable to do that.

-- Patrick Townsend-Wells - 2013-09-10

Regarding using full URLs: They won't be really useful because a URL, like its topic WikiWord name, refers to a "master topic" and not any of its "apparent topics."

Regarding variables: Currently, I am trying to get a variable that can be set in a topic and its setting can persist across topic navigation.

-- Patrick Townsend-Wells - 2013-09-10

Ah, the SetGetPlugin.

-- Patrick Townsend-Wells - 2013-09-10

SetGetPlugin does the job.

Good work!

-- Patrick Townsend-Wells - 2013-09-10

I am glad you found a workable solution.

-- Peter Thoeny - 2013-09-10

      Change status to:
ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
SupportForm
Status Answered
Title Determining previous topic name, and hyperlink nickname
SupportCategory

TWiki version

Server OS

Web server

Perl version

Browser & version

Edit | Attach | Watch | Print version | History: r9 < r8 < r7 < r6 < r5 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r9 - 2013-09-10 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.