Tags:
create new tag
, view all tags
I have need to break apart my WebTopicEditTemplate according to what parent your new Topic is in by default. I would like to create some high level topics that I fully expect to have many subtopics in. In each of these High Level topics I need a way to have a different edit template when a user creates a new topic. Maybe have the ability to create a new template called HighLevelOneTopicEditTemplate than have the code search the parents of the created topic to determine if a topic template exists that fits one of those parent names.

-- JohnShuell - 02 Jun 2002

This is not a direct solution to the above problem, but a better fit than SelectableNewTopicTemplates...

CloneTopicLinkUnderMore solved the problem of using any page as template for a new one. Nevertheless, if you use forms heavily, you will typically want one template page per form; you need to create one specific HTML <form> to achieve this, and you must go throught this path to have get this template.

Here is a patch to the WebTopicViewTemplate, which offers all template$ pages as drop-down choice:

---+++ If you would like to create this page:

<blockquote>
<form action="%SCRIPTURLPATH%/edit%SCRIPTSUFFIX%/%INCLUDINGWEB%/%BASETOPIC%">
Select a page template
<select name="templatetopic">
<option value="TWiki.WebTopicEditTemplate">Default...</option>
%SEARCH{"Template.txt" scope="topic" nosearch="on" nototal="on" format="<option value=$topic>$topic</option>"}%
</select>
then
<input type="submit" value="Create">
new page.
</form>
</blockquote>

which yields:

If you would like to create this page:

Select a page template then new page.

Note, that the pattern "Template.txt" matches topic names ending in "Template" -- the more logical "Template$" fails.

The WebTopicNonWikiTemplate needs the same patch. To spare you some (future) efforts, just include the above template and add the warning as sidebar like so:

<table align=right width=25%><tr bgcolor=#ffcccc><td>
---++ WARNING!
It is not recommended to use this topic name,
because it will not be linked automatically.
See %TWIKIWEB%.WikiWord for details on words with automatic linking.

<br>
</td>
</tr>
</table>
%INCLUDE{%TWIKIWEB%.WebTopicViewTemplate}%

Open issue: a selectable template for MissingWikiWordsLikeThis like requested above. To do so, you need an interim page to select the template. I tend to simply point it to /twiki/view, which in turn leads to WebTopicViewTemplate -- any other ideas? Of course, this is not as convenient, as deriving the template automagically from the parent.

-- PeterKlausner - 04 May 2003

Oops: the second template WebTopicNonWikiTemplate fails, because the first WebTopicViewTemplate doesn't take into account, that it might be included; fixed above.

-- PeterKlausner - 21 May 2003

Woa. Topic templates turn my mind to spaghetti. smile Here a the key points that helped me get straighten it out:

TWiki.WebTopicViewTemplate is what you see when a non-existant page link is followed. This is the topic you need to put the select form in. WebTopicEditTemplate is what is used to fill the new empty page after you hit the create link.

So, the view template is before create, edit template is after create.

In the select form above, the 'default' template is grabbed from the TWiki web, and is hardcoded in the option value line (delete "TWiki." to grab from the current web).

The templates in the drop down list are only from the current web.

-- MattWilkie - 12 Jun 2003

Excellent! This saves a lot of time. See a combined form with parent and template selection in action on http://www.visiblearea.com/cgi-bin/twiki/view/Patterns?topic=newtopic

-- ArthurClemens - 19 Aug 2003

Hmm. This all seems like it's moving in the right direction, but I'm hoping for something a little more automatic. What I'd really like is a topic-wide template setting such that clicking on an unlinked WikiWord's question mark in that topic causes a pre-filled edit template to appear for the new topic.

Example topic text:

Here I am talking about something, when all of a sudden I enter a WikiWord for a PageThatNeedsToBeCreated. When I click the question mark after PageThatNeedsToBeCreated, the edit box should be pre-filled with the content of SomeTopicIWantToClone.

Does that make sense? Am I explaining it right? I'm happy to dive in and code a Plugin for it, but I need a pointer in the right direction (having never mucked with TWiki's template system before)

-- MichaelBKlein - 18 Feb 2004

I've created a plugin that allows you to specify the template topic to be used when creating topics from unlinked WikiWord.

Have a look at ChildTopicTemplatePlugin

-- DeanCording - 04 Jun 2004

Dean, neat plugin....

-- ThomasWeigert - 05 Jun 2004

Edit | Attach | Watch | Print version | History: r10 < r9 < r8 < r7 < r6 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r10 - 2004-06-05 - 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-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.