Forum OpenACS Development: CR's rendering features

Request notifications

Posted by Lars Pind on
I'm trying to get CR's features for rendering content items to work for me, and I'm having some issues.

The first thing I need to know is if anyone's using this stuff, so that I can avoid breaking things that are being used, and so that I can learn how to use it properly, so I can possibly avoid making changes in the first place.

I have two conten items. One is an image, stored in the file system.

The other is a content item with text/html content. It has the image as a related item (cr_item_rels) with relation_tag "image". Its contents contain this tag:

<relation tag="image" index="1" embed>

What I want is for this tag to be replaced with <img src="path-to-image-in-the-file-system' ...>

I've managed to get it to work as expepcted, but only by hacking publish-procs.tcl a bit.

The problem is that the publish::handle_binary_file proc called by publish::handle::image tried to merge the image with a template unless you specify -no_merge. Unfortunately, I can't find any right way to pass this switch to it.

The question is: Does anybody know how it's supposed to work?

There's all this code that handles merging the binary image file with a template, so I'm assuming that there's some thought behind it. But what should the template for merging with the image look like?

On the other hand, publish::handle::image also has code to spit out the <img ...> tag when handle_binary_file does not merge with a template. So there ought to be some way to tell it not to, yet I cannot find it.

My hack that works is to simply add the -no_merge switch to the call to handle_binary_file inside publish::handle::image. But that obviously precludes using a template.

Any clues?

Any complaints if I mock with this? Nobody's using this, right?

I don't think anybody is, because some required procs were missing from acs-content-repository/tcl/cpublish-procs.tcl that were present in cms/tcl/publish-procs.tcl, so things didn't work.

Thanks for your help.


Posted by Jun Yamog on
Hi Lars,

Not aware of anyone using it.  I had a hard time trying to understand it, so I am just using normal templating system.  The way I dealed with the related images.  I that I had a related-images file which was included on the template that rendered the content.

Hope you make it run and see how it goes.

Posted by Dave Bauer on

Are you using the content-repository features alone? Did you check into how the CMS package uses this feature?

Posted by Lars Pind on
I haven't been able to find any evidence of how this is used in the CMS package, presumably since the tag is going in the content, not in the code, so there wouldn't be any evidence of this in the code.

Also, the documentation doesn't offer any useful help.

Do you know of a place where I should look?