Page 1 of 1
Message after posting a comment
Posted: Thu Apr 07, 2005 3:02 pm
by ruijt
Hi,
Can anyone please help me. I'm trying to get rid of the message you get right after posting a comment (pop-up mode). What I want is that after you press the submit button, the pop-up windows shows the comments again instead of the message "your message has been submitted, click here to get back to the comments".
I can't find how to do this.
Thanks! SeBasTiaan
Re: Message after posting a comment
Posted: Thu Apr 07, 2005 3:24 pm
by garvinhicking
Edit your commentform.tpl template.
One possible suggestion is this:
Code: Select all
{if $is_xhtml}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
{else}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
{/if}
<html>
<head>
<title>{$head_title|@default:$blogTitle} {if $head_subtitle} - {$head_subtitle}{/if}</title>
<meta http-equiv="Content-Type" content="text/html; charset={$head_charset}" />
<meta name="Powered-By" content="Serendipity v.{$head_version}" />
<link rel="stylesheet" type="text/css" href="{$serendipityHTTPPath}serendipity.css.php" />
<link rel="alternate" type="application/rss+xml" title="{$blogTitle} RSS feed" href="{$serendipityBaseURL}{$serendipityRewritePrefix}feeds/index.rss2" />
<link rel="alternate" type="application/x.atom+xml" title="{$blogTitle} Atom feed" href="{$serendipityBaseURL}{$serendipityRewritePrefix}feeds/atom.xml" />
</head>
<body class="s9y_wrap" id="serendipity_comment_page">
{if $is_comment_added}
{$CONST.COMMENT_ADDED}{$comment_string.0}<a href="{$comment_url}">{$comment_string.1}</a>{$comment_string.2}<a href="#" onclick="self.close()">{$comment_string.3}</a>{$comment_string.4}
{elseif $is_comment_notadded}
{$CONST.COMMENT_NOT_ADDED}{$comment_string.0}<a href="{$comment_url}">{$comment_string.1}</a>{$comment_string.2}<a href="#" onclick="self.close()">{$comment_string.3}</a>{$comment_string.4}
{elseif $is_comment_empty}
{$CONST.EMPTY_COMMENT}{$comment_string.0}<a href="#" onclick="history.go(-1)">{$comment_string.1}</a>
{/if}
{if $is_showtrackbacks}
<div class="serendipity_commentsTitle">{$CONST.TRACKBACKS}</div><br />
<dl>
<dt><b>{$CONST.TRACKBACK_SPECIFIC}:</b><br /></dt>
<dd><a rel="nofollow" href="{$comment_url}">{$comment_url}</a><br /></dd>
<dt><b>{$CONST.DIRECT_LINK}:</b><br /></dt>
<dd><a href="{$comment_entryurl}">{$comment_entryurl}</a></dd>
</dl>
{serendipity_printTrackbacks entry=$entry_id}
{elseif $is_showcomments}
<div class="serendipity_commentsTitle">{$CONST.COMMENTS}</div>
{serendipity_printComments entry=$entry_id}
{if $is_comment_allowed}
<div class="serendipity_commentsTitle">{$CONST.ADD_COMMENT}</div>
{$COMMENTFORM}
{else}
<div class="serendipity_center serendipity_msg_important">{$CONST.COMMENTS_CLOSED}</div>
{/if}
{/if}
</body>
</html>
About in the middle of the code I broke the if/elseif combination and split them into showing first the message and then the comments again.
This is untested, though. You may need to edit some other things for this.
Regards,
Garvin
... still not working
Posted: Fri Apr 08, 2005 11:06 am
by ruijt
I'm sorry but I just can't get it right. I tried this script you gave me but then nothing apears anymore in the popup window.
Isn't the name of this file commentpopup.tpl instead of form?
Can you please help me again...
Re: ... still not working
Posted: Fri Apr 08, 2005 1:48 pm
by garvinhicking
I'm sorry, I mistyped it, you are right. The file you need is 'commentpopup.tpl'.
I just changed 1 line of the pasted code above; please find that line (about the middle, the if-structures) and only change that line instead of pasting the whole code to the file.
Regards,
Garvin
Posted: Fri Apr 08, 2005 2:03 pm
by ruijt
I'm really sorry but I tried the changes you made to the script, but still after submitting the comment, I get this message instead of the comments:
Your comment was successfully added. Click here to return to the comments, and here to close this window.
I just don't want to see this message after submitting a comment.
Hopefully you can help me

Thanks HEAPS!!!
Posted: Fri Apr 08, 2005 2:18 pm
by garvinhicking
Insert those two lines:
Code: Select all
{assign var="is_showcomments" value="true"}
{assign var="is_comment_allowed" value="true"}
just after the {if $is_comment_added} block, so that the entire file looks like this:
Code: Select all
{if $is_xhtml}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
{else}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
{/if}
<html>
<head>
<title>{$head_title|@default:$blogTitle} {if $head_subtitle} - {$head_subtitle}{/if}</title>
<meta http-equiv="Content-Type" content="text/html; charset={$head_charset}" />
<meta name="Powered-By" content="Serendipity v.{$head_version}" />
<link rel="stylesheet" type="text/css" href="{$serendipityHTTPPath}serendipity.css.php" />
<link rel="alternate" type="application/rss+xml" title="{$blogTitle} RSS feed" href="{$serendipityBaseURL}{$serendipityRewritePrefix}feeds/index.rss2" />
<link rel="alternate" type="application/x.atom+xml" title="{$blogTitle} Atom feed" href="{$serendipityBaseURL}{$serendipityRewritePrefix}feeds/atom.xml" />
</head>
<body class="s9y_wrap" id="serendipity_comment_page">
{if $is_comment_added}
{$CONST.COMMENT_ADDED}{$comment_string.0}<a href="{$comment_url}">{$comment_string.1}</a>{$comment_string.2}<a href="#" onclick="self.close()">{$comment_string.3}</a>{$comment_string.4}
{assign var="is_showcomments" value="true"}
{assign var="is_comment_allowed" value="true"}
{elseif $is_comment_notadded}
{$CONST.COMMENT_NOT_ADDED}{$comment_string.0}<a href="{$comment_url}">{$comment_string.1}</a>{$comment_string.2}<a href="#" onclick="self.close()">{$comment_string.3}</a>{$comment_string.4}
{elseif $is_comment_empty}
{$CONST.EMPTY_COMMENT}{$comment_string.0}<a href="#" onclick="history.go(-1)">{$comment_string.1}</a>
{elseif $is_showtrackbacks}
<div class="serendipity_commentsTitle">{$CONST.TRACKBACKS}</div><br />
<dl>
<dt><b>{$CONST.TRACKBACK_SPECIFIC}:</b><br /></dt>
<dd><a rel="nofollow" href="{$comment_url}">{$comment_url}</a><br /></dd>
<dt><b>{$CONST.DIRECT_LINK}:</b><br /></dt>
<dd><a href="{$comment_entryurl}">{$comment_entryurl}</a></dd>
</dl>
{serendipity_printTrackbacks entry=$entry_id}
{/if}
{if $is_showcomments}
<div class="serendipity_commentsTitle">{$CONST.COMMENTS}</div>
{serendipity_printComments entry=$entry_id}
{if $is_comment_allowed}
<div class="serendipity_commentsTitle">{$CONST.ADD_COMMENT}</div>
{$COMMENTFORM}
{else}
<div class="serendipity_center serendipity_msg_important">{$CONST.COMMENTS_CLOSED}</div>
{/if}
{/if}
</body>
</html>
HTH,
Garvin
Almost there
Posted: Fri Apr 08, 2005 2:25 pm
by ruijt
Yes! Almost there

I removed also the complete message in the block, so the only thing in there is:
{if $is_comment_added}
{assign var="is_showcomments" value="true"}
{assign var="is_comment_allowed" value="true"}
The only thing missing is the commentform underneath it. Is there also an easy rule for that bit?
GREAT!!!!!
Re: Almost there
Posted: Fri Apr 08, 2005 3:20 pm
by garvinhicking
Rujt, great.
About the commentform, that is actually a bit harder to do.
But I still post it.
1. Create a 'config.inc.php' file inside your template directory. There insert this code:
Code: Select all
function serendipity_smarty_displayCommentForm($params, &$smarty) {
global $serendipity;
$query = "SELECT id, last_modified, timestamp, allow_comments, moderate_comments FROM {$serendipity['dbPrefix']}entries WHERE id = '" . $params['id'] . "'";
$ca = serendipity_db_query($query, true);
return serendipity_displayCommentForm($params['id'], '?', NULL, $serendipity['POST'], true, $ca['moderate'], ca);
}
$serendipity['smarty']->register_function('serendipity_displayCommentForm', 'serendipity_smarty_displayCommentForm');
2. After the two {assign} calls in your commentpopup.tpl code add this:
Code: Select all
{serendipity_displayCommentForm id=$entry_id}
Then you're done

Damn...
Posted: Fri Apr 08, 2005 3:49 pm
by ruijt
Sorry mate... I really appreciate your time and effort, but this didn't work. Don't know what it does, but the function came right under the commentpopup link in an entry. Like this:
Comments(1)
function serendipity_smarty_displayCommentForm($params, &$smarty) { global $serendipity; $query = "SELECT id, last_modified, timestamp, allow_comments, moderate_comments FROM {$serendipity['dbPrefix']}entries WHERE id = '" . $params['id'] . "'"; $ca = serendipity_db_query($query, true); return serendipity_displayCommentForm($params['id'], '?', NULL, $serendipity['POST'], true, $ca['moderate'], ca); } $serendipity['smarty']->register_function('serendipity_displayCommentForm', 'serendipity_smarty_displayCommentForm');
Do I need to install anything extra for this function? SMARTY of something?
Re: Damn...
Posted: Sat Apr 09, 2005 12:58 am
by garvinhicking
Oh, I'm sorry. I forgot to mention the <?php and ?> tags in the config.inc.php file! Add them at the top and bottom of the file, and then it should work:
Code: Select all
<?php
function serendipity_smarty_displayCommentForm($params, &$smarty) {
global $serendipity;
$query = "SELECT id, last_modified, timestamp, allow_comments, moderate_comments FROM {$serendipity['dbPrefix']}entries WHERE id = '" . $params['id'] . "'";
$ca = serendipity_db_query($query, true);
return serendipity_displayCommentForm($params['id'], '?', NULL, $serendipity['POST'], true, $ca['moderate'], ca);
}
$serendipity['smarty']->register_function('serendipity_displayCommentForm', 'serendipity_smarty_displayCommentForm');
?>