From: Chris W. <ch...@cw...> - 2003-07-22 16:58:31
|
Andrew Hurst wrote: > I'm trying to get the comments package to work with the news package, > so that I can have comments on the news stories on my OI site. At the > bottom of the news::news_detail template I've added the following: > > [% OI.comp( 'show_comment_summary', object = news ) %] > > [% PROCESS comments::comment_form_page( object = news ) %] > > That shows the comment form correctly, but it doesn't allow me to post > comments. The error I get is "Insufficient data supplied to fetch > comments by object." It doesn't appear to be getting the object > information that it needs. When I look at the post comments form in > html, the hidden values at the bottom are: > ... FWIW, on my site I have: [% OI.comp( 'show_comment_by_object', object => news ) %] at the bottom of the 'news::news_detail' template. I think there are some dependencies here that I never explicitly drew out. What the 'show_comment_by_object' component will do is fetch the comments for a particular object then pass them to 'comment::comment_list'. Additionally the 'comment::comment_form' wants a 'commment' object that's already been filled in with the class and object ID. (These are the empty hidden entries you're seeing.) What you probably want is: [% OI.comp( 'new_comment_form', object => news ) %] This pulls the class/id out of the object and puts it into a new comment object. It also grabs data saved in the cookie (name/email/url) and puts it in the new comment object. It then passes the comment object to 'comment::comment_form' which is happy. I hope that makes sense. I worked on this package some time ago and it's a little fuzzy :-) I'm going to work on it in the next week or two to port it to OI2 so it will be fresher. > Related to this, I've noticed (or I think I have ;) that lots of the > templates are cached, so that when I make a change to the templates, > sometimes I won't see it for a few requests. I guess that's because the > template it cached within each child request? Is there any way around > this? I've thought about changing template_info->{cache_size} to 0, but > was worried that that would make performance too slow to stand while > messing around. Any thoughts? How do other people handle this? Yes, they're cached. You can get around this by restarting the server, which sucks. Or by just not caching the templates. The performance difference shouldn't be *that* great (TT is still pretty quick), and since you're in development you don't care as much about that anyway. Well, at least I don't. Chris -- Chris Winters (ch...@cw...) Building enterprise-capable snack solutions since 1988. |