Database publishing advice

I’m after a bit of advice on the best method to use for some of our database publishing.

We have a ‘Course’ content type which in turn can have a number of ‘Publications’ associated with it.

At present I have a sys_Table control in my ‘Course’ content type which then uses a lookup to pull in the ‘Publications’ into a drop down, and the content id of this publication is stored and in turn published out to a database.

Would I be better implementing this as a slot which could then be populated with the necessary ‘Publications’?

If so, how would I go about getting the value of all the content id’s of the items in the slot?

Cheers.

Yes, you would be better off using a slot.

The PSOSlotTools.getSlotContents (in the PSO Toolkit) can help you get the items in the slot (and hence their content ids).

Thanks Dave.

I found some talk on getSlotContents on a previous thread.

I managed to get this to return the contents of the slot ok, but I can only manage to pull out the content id for the first item in the slot.

How can I access all of the slot items to publish?

You have to iterate over the items in the slot. Normally you use #foreach for this. If you post your template code, I might be able to point you in the right direction.

Dave

Hi Dave,

Sorry, bit confused here. The template code is just the xml for the database publish.

Cheers,
Chris.

Is this a 6.5 system, or 6.1?

In 6.5, you can write foreach loops in jexl bindings. You can also use the size() operator to return the length of the list.

In 6.1 there are some other techniques: let me know if that’s what you need to do.

Thanks Dave, its 6.5 so I can use the loop in the bindings if you could give me a few pointers.

Cheers,
Chris

I’m doing something wrong along the lines somewhere.
In my bindings I’m trying to loop over the items returned by getSlotContents() so that they can be published to a child table.

My bindings are:
$slotContents -> $user.psoSlotTools.getSlotContents($sys.assemblyItem, “ntuCoursePublications”, $slotparams)
[B]$child[2].cplCourseID -> $sys.item.getProperty(“rx:sys_contentid”)
$child[2].cplSeq -> $rx.db.sequence(1,1)
$child[2].cplPublicationID-> foreach($mySlotItem in $slotContents) { $mySlotItem.getNode().getProperty(“rx:sys_contentid”).String ; }

[/B]But this still only returns the first item in the slot?

Cheers,
Chris.