Tags:
create new tag
view all tags

SID-02217: Need help setting up an alternate topic view

Status: Answered Answered TWiki version: 6.0.2 Perl version: 5.14.2
Category: CategorySkin Server OS: Ubuntu Linux 14.04.2 LTS Last update: 10 years ago

I'm sure this is easy to do by having a special skin modification, but changing skins seems to be beyond my limited brain power. smile

I want to be able to view a topic containing a form. I can almost get what I want by using the "form at top of frame" setting, but I need something a little different. I want the form at the top of the topic, but I want the topic topic to be displayed ABOVE the form.

Any help on this would be greatly appreciated.

-- Larry Bristol - 2016-06-24

Discussion and Answer

PatternSkinCustomization is a good place to start.

I don't understand, you want the form at the top of the topic, and the topic content above the form? So which is it?

Some pointers. Create a custom view template topic, such as AccountViewTemplate with this content:

%TMPL:INCLUDE{"view"}%
%TMPL:DEF{"formtop"}%%INCLUDE{AccountHeader}%%TMPL:END%
%TMPL:DEF{"formbottom"}%%INCLUDE{AccountFooter}%%TMPL:END%

Then create AccountHeader and AccountFooter with whatever content you want before and after the topic content.

Now enable that view template on your template topic such as AccountTemplate used to create new topics. Add this topic preferences setting:

   * Set VIEW_TEMPLATE = AccountView

This will show your custom header and footer on every topic based on the AccountTemplate.

-- Peter Thoeny - 2016-06-25

Sorry. I should have proofread my question more carefully.

I want to put the topic TITLE above the form. The rest of the topic content should be below the form.

I note that the first line of a form display is an empty box. Is there any way to put something in that box?

-- Larry Bristol - 2016-06-27

With above mentioned apprach, you can put anything you want in the AccountHeader. That includes a custom view of you form content. For example if you have a field called "Address" you can show the form field value using %FORMFIELD{ "Address" topic="%INCLUDINGTOPIC%" }%. If you have a field called "Title" you could show that title as an H1 heading. Details at VarINCLUDE, VarFORMFIELD.

-- Peter Thoeny - 2016-06-28

Now I'm even more confused. I am obviously missing something that is probably obvious to everyone but me. There is no field in the form named "Title".

This is what I use to get the form displayed before the text:

Here is TopFormViewTemplate:

%TMPL:INCLUDE{"view"}%
%TMPL:DEF{"form"}%%META{"form"}%%TMPL:END%
%TMPL:DEF{"formattop"}%%TMPL:P{"form"}%%TMPL:END%
%TMPL:DEF{"formatbottom"}%%TMPL:END%

This works fine as far as it goes. The first thing on the page is the form, followed by all the topic text. But that includes the rendering for this bit of text:

---+ %TOPIC%

I want the H1 heading to appear ABOVE the form. (Or alternately, within the empty box on line 1 of the form.)

-- Larry Bristol - 2016-06-28

You are almost there. Simply add the H1 heading:

%TMPL:INCLUDE{"view"}%
%TMPL:DEF{"form"}%
---+ %SPACEOUT{%TOPIC%}%
%META{"form"}%%TMPL:END%
%TMPL:DEF{"formattop"}%%TMPL:P{"form"}%%TMPL:END%
%TMPL:DEF{"formatbottom"}%%TMPL:END%

BTW, to enable a view template, exclude the Template suffix, e.g. write:

   * Set VIEW_TEMPLATE = Main.TopFormView

-- Peter Thoeny - 2016-06-28

PERFECT! And so easy. I obviously need to learn more about this %TMPL thing.

Silly question about the BTW comment: It seems to work either way, Set ... = Main.TopFormView, or Main.TopFormViewTemplate. And the presence or absence of the nop (!) seems to make no difference, either.

Thanks!

-- Larry Bristol - 2016-06-28

Oops, the ! is not needed, I added it by mistake to a pre-tag section. Fixed now in my previous post.

-- Peter Thoeny - 2016-06-29

      Change status to:
ALERT! 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.
SupportForm
Status Answered
Title Need help setting up an alternate topic view
SupportCategory CategorySkin
TWiki version 6.0.2
Server OS Ubuntu Linux 14.04.2 LTS
Web server Apache2
Perl version 5.14.2
Browser & version Firefox 47.0
Edit | Attach | Watch | Print version | History: r8 < r7 < r6 < r5 < r4 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r8 - 2016-06-29 - 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.