Hi,

At the outset - I admit to being a complete and total newbie at this.
Apologize for asking what are probably dumb questions - and likely to be
lots more than one. Any help people would be willing to give me would be
much appreciated.

I have been through all the tutorials, the API JavaDoc, and as many examples
of code as I could find, but I still can't seem to find anything that looks
directly applicable or works when I try to adapt it.

What I'm ultimately trying to do seems pretty straightforward. I would like
to have a set of pages which each contain structured data that can be
modified, added, or deleted one object at a time, and which display in
reverse chronological order. I would like each of those objects to be
displayed with specific HTML formatting. Eventually, I will also need to be
able to interact with those objects using the REST API. My current
understanding of the process I need to use to get started is this:

1) Create a new Class (We'll call it "Entry") with specific properties
2) Create the Class Sheet and Template. The Template includes a link to the
Class Sheet for displaying instances of the class.
3) Edit the Class Sheet to get the attached objects to display properly
4) Create a new page from the Template, add several instances of the class
to it - they should then display on the new page.

First two steps are easy - but the first place that I am hung up is figuring
out how to get the Class Sheet to display multiple objects of the same class
attached to the same page.

I have a page with 3 objects of the Entry class attached (with different
info in the properties). Ultimately the info and formatting will need to be
more complex, but I can't even get the basics to work - this is what I have
tried so far:

****START CODE****
#foreach($entry in $doc.getObjects("XWiki.EntryClass"))
  #foreach($prop in $entry.properties)
    : $doc.display($prop.getName())
  #end
#end
****END CODE***

The problem is that this code displays the info for the first object three
times, instead of the unique properties for each class. The fact that it
displays three times seems to indicate that the loop is correctly going
through each object in the document - but it is obviously not incrementing
the properties to the next $entry. Sure it's a simple syntax error, but
don't know what it is.

I also can't tell from the JavaDoc enough about how to use .display() or the
properties of a vector to know how to do basic things like display the
number of objects or the name of each one. Can't figure out how to interact
with objects very well, basically.

Side question - Should I be using one object per page and then including
pages instead of having multiple objects on one page? I have worked my way
through the TOC demo, and it seems that each TOC entry is saved on a
separate page - and the livetable macro is then used on the "display" page
to populate the table with all the entries.

Thank you in advance,

Aaron
_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to