Question
I want to define a special project template in my Projects web. New projects (topics) can be created by the user typing a project name into an input form. I have used the following parameter in the form to create a new topic using my own new templatetopic:
<form name="newtopic" action="%SCRIPTURLPATH{"edit"}%/%WEB%/">
<input type="hidden" name="formtemplate" value="GeneralProjectForm" />
New topic name
<input type="text" name="topic" size="40" />
<input type="hidden" name="templatetopic" value="NewProjectTemplate" />
<input type="submit" class="twikiSubmit" value="Create" />
</form>
And this is what's in the
NewProjectTemplate
%TMPL:INCLUDE{"view"}% %TMPL:DEF{"topicactionbuttons"}%%TMPL:P{"activatable_more"}% TESTING ME %TMPL:END%
As far as I can understand, when a new project topic is created, it should use the =
NewProjectTemplate= as the new template.
But what happens is that it opens the WYSIWYG editor and pastes the content of the template File (
%TMPL...etc) into the editing field.
I did manage to define my own template and I can look at a topic using that template by adding
?template=NewProject to the address URL.
Removing the
<input type="hidden" name="formtemplate" value="GeneralProjectForm" />
from the input form does not change the outcome. For some reason the create routine just simply copies the contents of the template into the edit form, without taking any consideration of its contents.
I don't know how to locate the problem. Is there anything I totally misunderstood?
Thanks for any pointers
Environment
--
YogiParish - 05 Mar 2008
Answer
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.
Strange, that should work. Possibly something wrong with the
{TemplatePath} in configure? Try to rename the project template topic to something else, such as
NewProjectTemplate.
--
PeterThoeny - 12 Mar 2008
I tried and it doesnt work. The value of my =
TemplateDir = seems fine. It is = /srv/www/htdocs/ntwiki/templates =. I have updated the description of the problem above to give more information.
--
YogiParish - 13 Mar 2008
My point was to rename it to a name
other than
...ViewTemplate, e.g.
NewProjectTemplate.
--
PeterThoeny - 13 Mar 2008
Nope, sorry, didnt work either. I changed the above description again. I can set some variables to define the EDIT template, right?
--
YogiParish - 14 Mar 2008
I'm still not further yet.
Could
anybody please test this for me? I just cant seem to get any further on this problem.
--
YogiParish - 02 Apr 2008
Sorry Yogi, I don't understand what you are trying to do (either) but I have provided a
playground
for you (and others that may understand your needs) in the LitterTray web of Bugs. Hope that somehow helps.
--
FranzJosefGigler - 03 Apr 2008
Thank you very much, Franz!! Maybe I can explain the problem a little better. If you click on the
create button a new page should be created using the page template that is defined in
NewProjectTemplate.
But instead of using the template to define the rendering of the page, all it does is insert the text into the page:
Wrong Result
And this is what it should like when the TEMPLATE commands are rendered by the engine: (the text that is seen on the page)
Rendered TMPL directives
--
YogiParish - 04 Apr 2008
Now (I think) I understand what you want. You want to create topics that have a customized view. You can do this skin customization if you understand the difference between view (resp. script) templates and topic templates.
You (almost) get the effect that you want by using
NewProjectViewTemplate
which implements the view (script) customization (that means you do customize the skin locally) and a
NewProjectTopicTemplate
that uses the view (script) customization locally and defines the content of new project topics.
I've updated the
playground
accordingly. This behaviour is documented in
PatternSkinCustomization
. See
AnotherTestWithTopicTemplate
for the created result.
So you're almost there, aren't you?
--
FranzJosefGigler - 04 Apr 2008
I have a (maybe) similar problem in 4.2. Here is what I did:
- I what to create a page via below html form that has a TWiki form in it:
<form name="newEva" action="%SCRIPTURLPATH{edit}%/%WEB%/" method="post">
<input type="hidden" name="templatetopic" value="EvaluationTemplate" />
<input type="hidden" name="formtemplate" value="EvaluationForm" />
<input type="hidden" name="action" value="form" />
<input type="hidden" name="topic" value="%TOPIC%ByMagicYang" />
<input type="submit" value="Fill Evaluation Form!" />
</form>
- "EvaluationForm" contains my TWiki form definition and I use parameter "formtemplate" and "action" with value "form"
- I want my TWiki form can appear at the above (but not regular edit textarea) in later editing, I reuse user profile view "Main.UserView" in my "EvaluationTemplate" like below
<!--
* Set VIEW_TEMPLATE = Main.UserView
-->
This submit form work well in 4.1.2 but fail in 4.2. When I put
templatetopic &
formtemplate together in 4.2. templatetopic fail to bring my template (Set VIEW_TEMPLATE =
UserView) into new created page!!
--
MagicYang - 12 Apr 2008
Hm, the topic name of the user view template on my 4.2 installation is
PatternSkinUserViewTemplate, so you would have to add
<!--
* Set VIEW_TEMPLATE = Main.PatternSkinUserView
-->
to your topic template. Maybe this is a hidden pattern skin change. Seems to work on this topic. Please reopen this question if necessary.
Tip: You really should create an extra EvaluationViewTemplate for this purpose!
--
FranzJosefGigler - 14 Apr 2008
Thanks for your information, Franz! But because I merge the data from 4.1.2 to 4.2, I have both PatternSkinUserViewTemplate & UserViewTemplate in my Main web.
No matter which one I use, When I put
templatetopic &
formtemplate together in 4.2. Parameter "templatetopic" fail to bring topic template (My EvaluationTemplate) content into new created page no matter what content in it!
Does anybody have alternative solution to create a new topic using both templatetopic & formtemplate at the same time?
--
MagicYang - 15 Apr 2008
Strange, as soon as I have the topic template and form topics in the same web used by your form code above it works as expected on my 4.2 system. Can you be more specific about how it fails? There must be something special about your local installation.
--
FranzJosefGigler - 15 Apr 2008
Dear Franz, do you have
<input type="hidden" name="action" value="form" />
in your form? When I omit this parameter, new created topic has my topic template's content and also has my form attached in it! It looks good!

But when I add this parameter, I expect to edit the form only but bring in my topic template content in background. This background action is work in 4.1.2 but fail in 4.2! I really don't have any idea about the problem in my installation....=(
Update! I try this feature on a fresh 4.2 installation like below:
- Upzip TWiki-4.2.0.tgz
- Copy my template topic & form definition topic into Main web (I didn't register the form in preference topic in this fresh installation)
- Create a TestTopic that contain my html form!
The test result is the same!!........=(
--
MagicYang - 16 Apr 2008
The first time I used your form I had the hidden action line and it didn't work. Then I guessed it was because I hadn't created the topic template and form topics. And I kicked out the hidden action line (cause I didn't know what it does

). Then it suddenly worked. The topic was created. Then I restored the hidden action line (because of curiosity what it may do) and it still worked and shows the form in edit mode only. Hm, maybe it's an access right problem.
No it isn't, I've updated the
playground
in the LitterTray web of our bug tracker (it's running the latest code version) and everything works as it IMHO should. Sorry, can't reproduce it.
--
FranzJosefGigler - 16 Apr 2008
I upload my test page
here. You can unzip these pages in any web and press the button in TestTopicWithActionParam & TestTopicWithoutActionParam.
Here is my
result and you can find that 2 result pages are different!
Is there any public TWiki 4.2 available that I can test these pages in?
--
MagicYang - 16 Apr 2008
I have (re)created your test
with
and
without
action parameter on our publicly accessible bug tracker (use your TWiki.org account to log in!)
--
FranzJosefGigler - 16 Apr 2008
Thanks a lot!
I try these test pages on the test site and the result is the same:
- content in EvaluationTemplate didn't appear in new created topic with "Action" in form.
but with another discovery:
- content in EvaluationTemplate that bring in to new topic without "Action" is strange %3C%21--%0A%20%20%20*%20ALLOWTOPICVIEW%20%3D%20Main.MagicYang%0A%20%20%20*%20ALLOWTOPICCHANGE%20%3D%20Main.MagicYang%0A%20%20%20*%20Set%20VIEW_TEMPLATE%20%3D%20Main.PatternSkinUserView%0A--%3E%0A
- This situation (maybe cause by new version WYSIWYG editor) didn't appear in my environment!
--
MagicYang - 17 Apr 2008
Hm, then it is overdue to add an item to our bug tracker. I can't help you further.
--
FranzJosefGigler - 17 Apr 2008
What is overdue?
I report a bug here:
TWikibug:Item5547
--
MagicYang - 17 Apr 2008
--
FranzJosefGigler - 08 Sep 2008