Tags:
create new tag
view all tags

Question

What I think I need is to be able to use different page templates in a web, depending on either the topic name or the attached form.

The context is that I want to support '*News' topics that can be listed on the News.WebHome page. I can create the summary listing using the SEARCH variable. ('*News' topics have topic names ending in 'News' and have an attached NewsForm). But I would like to make it easier for the users to raise new News topics.

Specifically, what I want is to be able to configure the News web so that users can click on a button somewhere and be given an HTML form that creates a new News topic and associates some form variables (News.NewsTitle etc) with the topic. If they revisit a News topic, they should get my HTML form rather than the standard one; but other topics in the web should use the standard template.

Is there any way of doing this? I have read through the documentation and this Wiki, and tried various options, but to no avail. I can create a Template Topic but that is not what I want.

  • TWiki version: 01 Dec 2001
  • Web server: Apache
  • Server OS: SunOS
  • Web browser: IE5
  • Client OS: NT4

-- MartinEllison - 10 Apr 2002

Answer

Sure, it is possible. Read some more smile : TWikiTemplates as an example of how form button can create new page based on specific template (using hidden fields).

-- PeterMasiar - 11 Apr 2002

Thanks for replying, but that doesn't actually answer my question... and I had already read the documentation before I posted.

What that can do is generate a new topic from a form. But then the new topic is displayed using the standard view template. If the user then want to edit the topic, they get the standard edit template. In both these cases, the form fields are displayed in the standard table at the bottom of the page. I would like to specify my own page layout that includes some text boxes etc and to associate the form fields with those text boxes.

[Having just flipped through the February CACM, I can see that there are much wider issues involved in the whole forms/TWiki situation, but this isn't the place to discuss them].

-- MartinEllison - 11 Apr 2002

Mea culpa. Do you want customize how form at page bottom is rendered? If so - I cannot help you, sorry.

Or do you want custom page header and footer ( =~ view template in text above)? This is doable, handled by skin. You may have only one default skin per web, but you can force skin at hyperlinlink. I can send you link how to do that, if you are interested. It s/b possible to generate page (using formatted search), where each link has other, non-default skin for view (warning: I never tried it!). And in custom view skin, you may add link to another custom skin for edit. Looks like a lot of work. Good for you to have resources/time/enthusiasm for that wink . I prefer the simplest design I can get away without my users complaining too loud.

I returned page back to Asked Questions. frown

-- PeterMasiar - 12 Apr 2002

Martin - I'm very interested in what you are asking about because I am also contemplating similar applications and I'm trying to understand how to use forms and templates. However, I'm having some trouble seeing exactly what you're wanting and where you're getting stopped with implementing it in TWiki. It seems to me that it's very capable of doing what you're asking.

I'd like to go through it step by step and see if I'm with you. I'm also going to refer you to another example that may come a little closer to what you're looking for. It's the ItemToDo application PeterThoeny created.

In this case, the sequence goes as follows:

  1. The user is offered a form to create a new topic. You'll notice that the form already has "Item" as the default first part of name for new topic. This seems to address your desire to create default topic names starting with "News."
  2. The resulting new topic uses a custom "Item To Do" page template that includes a custom "Item To Do" form at the bottom. Again, this seems to me to be most of what you are asking for. The only difference is that it seems that you want to create your own custom html form that inserts the data entered into the TWiki custom form. Why bother doing this? Maybe I'm not understanding you here.
  3. After the topic is created, it uses the standard "view" template (which merely provides header and footer) however the custom page templates and form remain.
  4. If someone edits the topic, you get the custom page template and form again. At no point in this process does default page template or forms for the web come into play.

It seems to me that this substantially achieves what you're asking for. What am I missing?

-- LynnwoodBrown - 12 Apr 2002

I have had a few thought about this at XMLAndForms -- this is filed under FeatureBrainstorming because it is very speculative.

-- MartinEllison - 29 Apr 2002

I have been trying to do similar things. I think the rendering side of this is covered by formatted search. This is obviously useful for pages like the ItemToDo topic. I struggled for a while trying to find a way of accessing form metadata using a simple variable expansion but it seems search is the only way (even if it is a search for an exact match on a specific topic - possibly the current topic). One problem with using formatted search for this is that while it does provide a nice way for expanding the values of metadata fields in the output it doesn't (directly) provide a way for searching the form metadata. The method used in the ItemToDo topic is to use a regexp to "parse" the value from the metadata. I see there was some discussion in FormSearches about building this (and other) facilities into search but it doesn't look like much of a priority item? The other part of the puzzle is how to actually update fields without going through the full edit (preview) save cycle. It wouldn't seem too hard (I might yet try to do this myself) to write a metadata update plugin that would accept url parameters (generated from a html form submission) as names/values for metadata and update the page's metadata from this. I haven't found any built-in way of doing this.

-- DarrylGreen - 11 Jul 2002

Form search: See related QueryByExampleSearch, EditControlsBasedOnFormDefinition.

Update metadata: This could be solved by a Plugin. The plugin API is unfortunately not yet ready for topic save, but it can be done using undocumented funtions. One sample Plugin that does just that is the EditTablePlugin.

-- PeterThoeny - 12 Jul 2002

Edit | Attach | Watch | Print version | History: r9 < r8 < r7 < r6 < r5 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r9 - 2002-07-12 - 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.