CoComment

Discussion corner for Developers of Serendipity.
Post Reply
Be@t
Regular
Posts: 100
Joined: Sun Dec 18, 2005 5:24 pm
Location: switzerland
Contact:

CoComment

Post by Be@t »

I'd like to implement CoComment in my blog, but unfortunately I don't have Java- or Smarty-Skills. The following code is needed in the comments-form (WordPress-Example):
<script type="text/javascript">

var blogTool = "WordPress";
var blogURL = "<?php echo get_option('siteurl'); ?>";
var blogTitle = "<?php bloginfo('name'); ?>";
var postURL = "<?php the_permalink() ?>";
var postTitle = "<?php the_title(); ?>";<?php if ( $user_ID ) : ?>
var commentAuthor = "<?php echo $user_identity; ?>";<?php else : ?>
var commentAuthorFieldName = "author";<?php endif; ?>
var commentAuthorLoggedIn = <?php if ( !$user_ID ) { echo "false"; } else { echo "true"; } ?>;
var commentFormID = "commentform";
var commentTextFieldName = "comment";
var commentButtonName = "submit";

</script>
A Installation-Description ia available here.

I tried to manipulate my .../templates/default/commentform.tpl-file but without success.

Is somebody able to give me advice?

Thanks!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: CoComment

Post by garvinhicking »

You could try this on top of your commentform.tpl:

Code: Select all

<script type="text/javascript">

var blogTool               = 'WordPress'; // Use Serendipity here?
var blogURL                = '{$serendipityBaseURL|@escape:javascript}';
var blogTitle              = '{$blogTitle|@escape:javascript}';
var postURL                = '{$commentform_entry.rdf_ident|@escape:javascript}';
var postTitle              = '{$commentform_entry.title|@escape:javascript}';
var commentAuthor          = '{$commentform_name}';
var commentAuthorFieldName = 'serendipity[name]';
var commentAuthorLoggedIn  = '{if $is_logged_in}true{else}false{/if}';
var commentFormID          = 'serendipity_comment';
var commentTextFieldName   = 'serendipity[comment]';
var commentButtonName      = 'serendipity[submit]';

</script>

If that works, please tell us or the coComment people, so that we could include it somewhere?

Maybe you need to change the things like commentButtonName to use the ID fields instead of the NAME HTML attributes...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Be@t
Regular
Posts: 100
Joined: Sun Dec 18, 2005 5:24 pm
Location: switzerland
Contact:

Post by Be@t »

Hi garvin

THANKS!

It works.... partially. Actually I have little problems with the automatic coComment-login and the detection if coComment is available on the visited site or not.

Are you sure about this line:
var commentAuthorLoggedIn = '{if $is_logged_in}true{else}false{/if}';

This line is undocumented by coComment and I guess, the problem is here.

I will place a post in the coComment-Blog, maybe they can help.
I keep you informed.

Again: Thanks for your help!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

The "logged_in" feature actually requires a change to the serendipity_smarty_init() function, which I've committed to the 1.0 source tree. It requires a line like:

Code: Select all

             'is_raw_mode'               => $serendipity['smarty_raw_mode'],
+            'is_logged_in'              => serendipity_userLoggedIn(),
inside the function call.

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Be@t
Regular
Posts: 100
Joined: Sun Dec 18, 2005 5:24 pm
Location: switzerland
Contact:

Post by Be@t »

Hi garvin

Now it works perfectly.

The yesterday mentioned problems were not serendipity-problems. Your code work properly. I had only to reboot my notebook and afterwards it was working. :roll: :wink:

On my blog I stored a installation-description (in german) for serendipity0.9.1. In addition I sended coComment the mentioned description with your logo (s9y_banner_small.png).
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Cool! Please let me know if the guys from CoComment add anything about us :)

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Be@t
Regular
Posts: 100
Joined: Sun Dec 18, 2005 5:24 pm
Location: switzerland
Contact:

Post by Be@t »

Hi Garvin

The Serendipity-Logo is now in the list of "NOW WORKS WITH".
Have a look at: http://www.cocomment.com/

I puted the code for Serendipity in the Forum. Here: http://www.cocomment.com/forum/viewtopic.php?id=150

update 14. Feb.

Now they published a list with supported blog-SW. Serendipity is on it.
http://www.cocomment.com/supported


greetings
Be@t
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Post by yellowled »

I've tried the new cocomment code for s9y, but I get the following error message using it:

Code: Select all

Fatal error: Smarty error: [in file:xxx/commentform.tpl line 4]: syntax error: unrecognized tag ‘tool’ (Smarty_Compiler.class.php, line 580) in xxx/bundled-libs/Smarty/libs/Smarty.class.php on line 1088
Is this a s9y-specific issue or do the cocomment guys have to fix something or ..?

YL
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Hm, seems they didn't escape the "{" and "}" properly, try this:

Code: Select all

<script type="text/javascript">
// this ensures coComment gets the correct values
coco =
{ldelim}
     tool          : "Serendipity",
     siteurl       : "{$serendipityBaseURL|@escape:javascript}",
     sitetitle     : "{$blogTitle|@escape:javascript}",
     pageurl       : "{$commentform_entry.rdf_ident|@escape:javascript}",
     pagetitle     : "{$commentform_entry.title|@escape:javascript}",
     author        : "{$commentform_name}",
     authorID      : "serendipity[name]",
     formID        : "serendipity_comment",
     textareaID    : "serendipity[comment]",
     buttonID      : "serendipity[submit]"
{rdelim}
</script>
<script id="cocomment-fetchlet" src="http://www.cocomment.com/js/enabler.js" type="text/javascript">
// this activates coComment
</script>
If that works maybe you can submit this change to the cocomment guys?

Regards,
Garin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Post by yellowled »

garvinhicking wrote:If that works maybe you can submit this change to the cocomment guys?
It works, thanks. Someone already noticed this in the cocomment teamblog, so I'll just report that this code works and ask to change it in their code example.

Seems like they have some work left to do, though. Right now, I'm getting the cocomment bar under the textarea I'm writing this post in. Weird.

YL
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Post by yellowled »

garvinhicking wrote:If that works maybe you can submit this change to the cocomment guys?
Just for the record: The coComment docs now show the working code.

YL
Post Reply