Tags:
create new tag
view all tags

Question

I apologize if this turns out to be Well Documented {Tm}, but I couldn't come up with a search string that would find it. I have an application where I want to include a menu link that when clicked jumps directly to the edit mode for a particular topic (not the one that's current.) I can't seem to figure out quite how to make this work.

I can do something like

[[http://%HOST_HTTP%%SCRIPTURLPATH%/edit/%WEB%.MyTopicHere][Edit my topic.]]
but that doesn't include the ?t=[whatevernowis] parameter that the script seems to want.

Environment

TWiki version: TWikiRelease02Sep2004
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Fedora 2
Web server: Apache 2.0.5.1
Perl version:  
Client OS:  
Web Browser:  
Categories: Topic revisions

-- MichaelBaum - 03 Jun 2005

Answer

Here's whole link sytax you're looking for:

%SCRIPTURLPATH%/edit%SCRIPTSUFFIX%/%WEB%/%TOPIC%?t=%GMTIME{"$year$month$day$hours$minutes$seconds"}%

If the menu item is in the topic itself, the easier option is simply using the %EDITURL% variable. However, I don't think that will work if the link is contained in a topic that's inserted using %INCLUDE.

-- LynnwoodBrown - 03 Jun 2005

I'm not so sure about that. Doesn't the t argument in the edit link require a Unix-style time code along the lines of "1118072521"? And wouldn't %GMTIME{"$year$month$day$hours$minutes$seconds"} render something more like 2005Jun06154255????

-- MichaelBaum - 06 Jun 2005

2005Jun06154255 would actually work, as the point of the parameter is to generate a unique URL to prevent (browser) caching. the code doesn't actually do anything with it (afaik).

anyway, you "need" to use $mo, not $month, which i posted before, but it probably got massacred in a refactoring wink oh well smile btw, an example of this usage is located in the WebLeftBarPersonalTemplate

-- WillNorris - 06 Jun 2005

Ah. Of course. It doesn't actually calculate anything with the value. Still, when I tried to paste that string into my test document, it behaved way odd and took me to some commercial web services site as opposed to, oh, I don't know, loading my TWiki page for editing.

Was that because I was trying to use the TWiki link shorthand with the nested brackets: [[link code][link name]] ??? I notice in the WebLeftBarPersonalTemplate (which, actually, is where I was planning to use this) this trick is coded as straight-up HTML code with the <a ...> anchors and all.

And while I'm at it, should we maybe have a TWiki %VARIABLE% that exposes the timestamp string returned by time() at each new page load? I can imagine applications where that'd be useful.

-- MichaelBaum - 07 Jun 2005

Edit | Attach | Watch | Print version | History: r8 < r7 < r6 < r5 < r4 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r8 - 2005-06-07 - MichaelBaum
 
  • 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.