Hi Aaron, On Sat, Jun 27, 2009 at 1:55 AM, Aaron Digulla <[email protected]> wrote:
> Asiri Rathnayake schrieb: > > > So, when you complete the tutorial there should be three wiki pages > created: > > > > 1. One document for the Class definition (FAQs.FAQClass) > > > > 2. One document for the sheet (FAQs.FAQClassSheet) > > > > 3. One document for the template (FAQs.FAQClassTemplate) > > > > Questions for you: > > > > 1. Do you have all these three documents? > > 2. Are the syntax of all these documents set to xwiki/2.0 > > > > 3. On the sheet & template, are you sure you have the correct wiki code? > > That is sheet document should be referring the correct class document > > (FAQs.FAQClass) and the template document should be referring the > correnct > > sheet document (FAQs.FAQSheet). > > Okay, I think I got it now: After creating the class and the sheet, the > document you see is empty (the sheet). This is confusing since the class > exists and it has properties, so why is XWiki not displaying them? Because a 'sheet' (as described in the tutorial) is only a presentation template for an _OBJECT_ of a specific class. So, if you do not have an object of a class attached to that page you won't see any output. Think of it like this: 1. You create a class XWiki.MyClass 2. You create a 'sheet' (XWiki.MyClassSheet) that knows how to 'present' objects of type XWiki.MyClass 3. You create a page (MySpace.MyPage) and add it an object of type XWiki.MyClass 4. Inside the content of MySpace.MyPage you delegate the presentation of your XWiki.MyClass object to XWiki.MyClassSheet. (This is what is done with the includeForm directive) 5. The 'template' is only part of the class wizard to make (page+object) creation easier. I strongly agree with vincent here. Neither 'sheet' nor 'template' are core constructs of xwiki, they are just part of the class wizard which is an specific (yet another) application. For an example, I can do this: 1. I create a class (XWiki.Person) - Note that it doesn't have to be 'XWiki.PersonClass', although the class wizard application needs it to be so. 2. I create a web application (html forms) that asks a user to insert "first name" and "last name" of a person. 3. When the user submits the form, I create a new 'Object' of type 'XWiki.PersonClass' and add it to the Main.People page (say). 4. Users can add as many person records to Main.People as they wish (using my application or dierctly by editing objects of Main.People) 5. I create a 'sheet' (XWiki.PeopleDisplay) that can present a list of (XWiki.Person) objects. - Again it doesn't have to be XWiki.PersonSheet - As opposed to the FAQ tutorial, here XWiki.PeopleDisplay is displaying a "list" of XWiki.Person objects. 6. I include (XWiki.PeopleDisplay) in Main.People page's content (includeForm). 7. Voila! When you visit Main.People page, you see a list of persons added so far. Displayed so nicely by the sheet (XWiki.PeopleDisplay). 8. I can edit the 'sheet' (XWiki.PeopleDisplay) any time I want to chage the look of the persons list. 9. All of these can be done without compiling a single line of code, everything is built by editing wiki pages. And if you want, you can put ajax to the mix!!! (again by editing wiki pages). 10. (9) is what is soooo cool about xwiki :) I only hope I didn't make your understanding of xwiki worse :) Thanks. - Asiri _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
