Last modified by Simon Urli on 2023/10/10

<
From version < 81.1 >
edited by Manuel Smeria
on 2015/08/27
To version < 83.1 >
edited by Manuel Smeria
on 2015/08/27
>
Change comment: added missing part about removing the Template title

Summary

Details

Page properties
Content
... ... @@ -2,7 +2,7 @@
2 2  {{toc/}}
3 3  {{/box}}
4 4  
5 -This tutorial will show you how to build a Frequently Asked Questions (FAQs) [[Application>>platform:Features.Applications]] much like the one you can find on the [[FAQ page>>xwiki:FAQ.WebHome]]. This is a very simple application that makes use of XWiki's [[classes, properties, and objects>>platform:DevGuide.DataModel||anchor=HXWikiClasses2CObjects2CandProperties]]. It also uses a technique that you may frequently use as the basis for several different kinds of applications.
5 +This tutorial will show you how to build a Frequently Asked Questions (FAQs) [[Application>>platform:Features.Applications]] much like the one you can find on the [[FAQ page>>xwiki:FAQ.WebHome]]. This is a very simple application that makes use of XWiki's [[classes, properties, and objects>>platform:DevGuide.DataModel||anchor="HXWikiClasses2CObjects2CandProperties"]]. It also uses a technique that you may frequently use as the basis for several different kinds of applications.
6 6  
7 7  = Prerequisites for following the tutorial =
8 8  
... ... @@ -102,7 +102,7 @@
102 102  )))
103 103  * Click the first button ("Create the document sheet") to create the document sheet (the Page Design Sheet). This sheet determines how your page's objects will be rendered to the user. The document is automatically created.
104 104  * Click on "View the sheet document"
105 -* Edit that page in Object mode (make sure your user is an [[Advanced user>>platform:Features.PageEditing||anchor=HAdvancedMode]])
105 +* Edit that page in Object mode (make sure your user is an [[Advanced user>>platform:Features.PageEditing||anchor="HAdvancedMode"]])
106 106  * Add a XWiki.SheetClass object to the page
107 107  ** **Adding the XWiki.SheetClass object is important. It's because of this object that users will be sent to form edition mode when editing FAQ entries**
108 108  * Click "Save & View"
... ... @@ -127,7 +127,9 @@
127 127  As we mentioned, XWiki provides a mechanism that helps us create sheets used for both View and Edit mode.
128 128  This is the display function used in the line:
129 129  
130 -{{code language="none"}}: $doc.display($prop.getName()){{/code}}
130 +{{code language="none"}}
131 +: $doc.display($prop.getName())
132 +{{/code}}
131 131  
132 132  It detects the current mode (Edit or View) and displays the property referenced by its argument as the mode dictates:
133 133  
... ... @@ -138,7 +138,10 @@
138 138  
139 139  * Click "Save & View"
140 140  
143 +== Bind the Class to the Sheet ==
144 +
141 141  Next, we neet to bind our class document (FAQ.FAQClass) to this new sheet (FAQ.FAQSheet):
146 +
142 142  * Edit FAQ.FAQClass in Object mode and add a new object of type XWiki.ClassSheetBinding
143 143  * Type in FAQSheet inside the field
144 144  * Save & View
... ... @@ -160,9 +160,18 @@
160 160  * Click on "Add a FAQ object to the template ยป":(((
161 161  {{image reference="FAQObject.png"/}}
162 162  )))
163 -* Congratulations: you just created an Authoring Template! You're almost done now.(((
168 +
169 +Next we need to remove the title for the newly created template:
170 +
171 +* Navigate to FAQ.FAQTemplate
172 +* Edit this document in Wiki mode
173 +* Inside the Title field you have "FAQ Template" written -> delete this text
174 +* Save & View
175 +
176 +This step is needed so that all of our future entries don't have "FAQ Template" as their title.
177 +
178 +Congratulations: you just created an Authoring Template! You're almost done now.
164 164  {{image reference="FAQClass4.PNG"/}}
165 -)))
166 166  
167 167  = Create a home page for the FAQ application =
168 168  
... ... @@ -222,6 +222,7 @@
222 222  
223 223  Notice how there are some translation keys displayed inside the livetable.
224 224  Let's create a translations document and change those keys to actual text:
239 +
225 225  * Create a new page inside the FAQ space called Translations
226 226  * Edit it in Wiki mode and paste this content inside:(((
227 227  {{code language="none"}}
... ... @@ -228,7 +228,8 @@
228 228  faq.question=Question
229 229  faq.doc.creationDate=Creation Date
230 230  faq._actions=Actions
231 -{{/code}})))
246 +{{/code}}
247 +)))
232 232  * Save & View
233 233  * Edit FAQ.Translations in Object mode and add a new XWiki.TranslationDocumentClass object
234 234  * Save & View again
... ... @@ -279,12 +279,13 @@
279 279  == Creating new FAQ entries ==
280 280  
281 281  There are 2 ways for you to let your users create new FAQ entries:
298 +
282 282  1. Declare the FAQ as a template
283 283  1. Add a custom creation form
284 284  
285 285  === Using a Template ===
286 286  
287 -You will have to define a template provider [[as explained on this page>>extensions:Extension.Administration Application||anchor=HCreatethetemplateprovider]]
304 +You will have to define a template provider [[as explained on this page>>extensions:Extension.Administration Application||anchor="HCreatethetemplateprovider"]]
288 288  
289 289  Go to your wiki's administration interface, in the "Templates" section (Administration -> Content -> Templates). Create a new template provider in the "FAQ" space and name it "FAQTemplateProvider"
290 290  

Get Connected