Tags:
create new tag
, view all tags
Each Twiki web (er, directory) currently duplicates a lot of topics that usually not changed but does have per-web information (and substitutions of %WEB%). This includes "changes" "search" "index", etc. When you have 50+ webs (organized via HierarchicalNavigation), this duplication becomes a big maintenance hassle.

What we have done at our site is to define a "shared topics" directory. This allows all directories to reference that topic "as if" it was actually present in that directory (er. "web"), without actually being there. As we have added capability (for example, renaming a topic), the necessary bit is only added once in the shared topics directory, but it can be referenced from anywhere.

Because of how it is implemented, these topics do not show up in the index or any other operation that looks at the directory. Instead, we depend on our template having a link to the "AdminOperations". The links that are present in other places (like for "WebIndex") are entered as explicit <a href="topic"> -- this reflects the shared topics are not valid as "internal links", but the view script will find them properly.

We currently have about 20 shared topics. A few (like "AdminOperations") are linked directly from our templates. Some are administrator operations (rename topic, etc.), and a few are key wiki help topics that a referenced from various locations (the complete list is AdminOperations CreateSubdir CrossDirectoryLinks DeleteTopic DirectoryDescription DirectoryTree OfflineReadable RenameDirectory RenameTopic SubtreeRecentChanges WebChanges WebIndex WebNotify WebPreferences WebSearch WebStatistics WebTopics WikiName WikiWord)

I've attached the relevant bits of code -- its not much really.

The primary bits to add this are these:

  • A new config varible in wikicfg.pm $adminTopicDir
  • Changes to readTopic and few related functions
  • A web (directory) that holds the shared topics, along with the desired "standard content"
  • Modifications to templates if needed [to add link for "AdminOperations"]

One big advantage of this approach is that "Create a web" is then just "create a new directory" -- no initial contents are required. When a user first edits a shared topic such as DirectoryDescription (the "home" for that directory), he gets the default template (from the sahred directory), and then it is saved in the proper directory.

[Note: we've give up on different colors by directory -- so the WebPreferences is actually different only in the "users" directory)

-- StanleyKnutson - 24 Apr 2001

This is certainly a feasible way to do it. Thanks for sharing the code with the community.

Note that the latest Beta does avoid duplication of common topics by using %INCUDE{}%. You only need to update one common topic and it is reflected in all webs. Here is how it works on the example of the WebSearch topic:

  • There is a master WebSearch topic in the TWiki05x01 web.
  • WebSearch topics in other webs have only one line:
    %INCLUDE{"%TWIKIWEB%.WebSearch"}%.
  • One problem is how to handle web names, i.e. the current web in TWiki05x01.WebSearch is TWiki05x01, but must be Main for Main.WebSearch. The solution is the use %INCLUDINGWEB% instead of %WEB% in the master WebSearch topic located in the TWiki05x01 web. I.e. the search form starts like this:
    <form action="%SCRIPTURLPATH%/search%SCRIPTSUFFIX%/%INCLUDINGWEB%/">

-- PeterThoeny - 26 Apr 2001

Very old DeleteMe?

-- SamHasler - 15 Feb 2005

Topic attachments
I Attachment Action Size Date Who Comment
Texttxt shared-topics-patches.txt manage 4.4 K 2001-04-24 - 22:15 StanleyKnutson Changes to allow shared topics directory
Topic revision: r3 - 2005-02-15 - SamHasler
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.