Forum OpenACS Q&A: Trouble with comments and links on dynamic pages

I installed openACS last week, and mostly things have been smooth. The bboard module and classifieds were a snap, and I have a rewritten index.tcl file in the main www/ area doing what I want it to do.

And after some reading the forums, I figured out that my troubles with related links and comments on static pages had to do with missing html/body tags. Problem solved.

BUT.. I'm failing to make any progess getting comments and links to work with dynamic pages. I have James Thornton's (jamesthornton.com)'s dynamic_links_and_comments.tcl file in my /var/lib/aolserver/defaultacs/tcl directory. But now I'm stumped. Doing

ns_write [dynamic_display_comments_and_links $on_what_id
$on_which_table $title $module] 
gives me a server error, apparently related to no definition of $on_what_id (and probably on_which_table too). So what do I call in the index.tcl file to get these variables set?

Thanks in advance, and apologies for what is almost certainly a newbie question, but I'm just not making any progress slogging through the code, and the sample pages haven't been much help.

Cathy Sarisky

Cathy - Use this page's URL as an example:

https://openacs.org/bboard/q-and-a-fetch-msg.tcl?msg_id=0002We&topic_id=11&topic=OpenACS

You would set on_what_id to the value passed in by msg_id (0002We). Set on_which_table to the table containing the msg_ids.

Also, make sure you add an entry for this table in table_acs_properties. One of the columns is user_url_stub, and this is used when generating the links for items with comments on community-member.tcl.

If you don't have any IDs to pass it, then you may be better off making the page an ADP. To get OpenACS to include "Add a Comment | Add a Link" on the bottom of ADP pages, you basically use the add_comments_to_static_pages module, but you need to configure it to stuff adp pages, and you *may* need to create a new procedure by copying ad_serve_html_page (in ad-html.tcl) and modifying a few lines:

	#set stream [open $full_filename r]
	#set whole_page [read $stream]
	#close $stream

	set whole_page [ns_adp_parse -file $full_filename]
* Note: This is what I did last year so that I could add comments to ADP pages, but newer versions of OpenACS may have something like this built in.
Hi James,

Ah, I was definitely having a newbie moment before. Thanks for the pointers.

I had one other issue getting comments working (on a page that actually merited the "dynamic" name):

I was getting errors from format_general_comment, that it wasn't being passed $content. In the end, I took out the and merged lines 88 and 89, and now it works beautifully.

Thanks!
Cathy