Forum OpenACS Development: To associate 2 content_types
I need to create a relationship between pa_album and a custom content_type (i.e. ee_venue).
What'd be the best way to relate those content_types, through their items or objects?
I notice there's a ad_proc called content::item::relate, but its arguments item_id and object_id made me think twice if that ad_proc was intended to relate cr_items, but cr_items and acs_objects only.
There is quite some machinery in the content repository to relate stuff to content items, but might be overkill in many cases.
A very generic, no rocket-science way to relate arbitrary acs-objects is the attachments package. It is basically a two columns table referencing acs_objects (with proper on delete cascade defined in case one of the two objects gets deleted).
Hope this helps
I was expecting to create a relation such as: using acs_rels to create role and type, as in this sample with videos and thumbs :
As one of other solutions, I've written the following chunks to acs_rels data model, plus I’ve added a few other glue codes along with item-add.tcl , photos-add and so on. All them within a new and customized page and package.
Is there any documentation/tutorial about how to use cr_items and revisions within custom packages?
From item_id to album_id
set album_id [relation::get_object_two -object_id_one $item_id -rel_type "ee_item_album_rel"]
set item_id [relation::get_object_one -object_id_two $album_id -rel_type "ee_item_album_rel"]
I wonder if there's a tutorial as in:
HOW TO USE OBJECTS? :
we could add this thread as a new topic within the documentation
There's an item already, called as: Relating content to other objects.
This thread could be:
Relating content to other content items
You can use acs_data_links for simple relationships also.
Much simpler. If you are adding code to acs_rels you probably are making it more difficult than it needs to be.