Guillaume,
Thanks for the lead and the quick response. The BB application does indeed
look like it does something very close to what I need to replicate. I will
spend some time digging through the code until I understand it and will post
again if I can't figure it out. Looks very promising.
I have already discovered that the main thing I was missing in my previous
code were the getProperties() and getProperty() methods.
This code solved my initial problem:
#foreach($entry in $doc.getObjects('XWiki.EntryClass'))
#foreach($prop in $entry.getProperties())
$entry.getProperty("$prop.getName()").getValue()
#end
#end
Thanks again,
aaron
On Tue, Jun 28, 2011 at 3:59 PM, Guillaume Lerouge <guillaume(a)xwiki.com>wrote;wrote:
Hi Aaron,
the bulletin board application does this on topic pages:
http://extensions.xwiki.org/xwiki/bin/view/Extension/Bulletin+Board+Applica…
You can download it, install it locally and look at its code to see how
it's
done.
In any case, you can definitely have several objects on the page. You can
also edit your code as such in order to get each individual object and then
act on it:
#foreach($entry in $doc.getObjects("XWiki.EntryClass"))
#set($entryObj = $doc.getObject($entry))
$entry.prop1
$entry.prop2
#end
Hope this helps,
Guillaume
On Tue, Jun 28, 2011 at 23:59, Ashtar Communications <
ashtarcommunications(a)gmail.com> wrote:
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(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users