Recent Topics

1 Jan 02, 2006 06:24    

:D New Year

I've changed Leave_comment form and this the code:

<?php 
/**
 * This is the template that displays the feedback for a post
 * (comments, trackbacks, pingbacks...)
 *
 * This file is not meant to be called directly.
 * It is meant to be called by an include in the _main.php template.
 * To display a feedback, you should call a stub AND pass the right parameters
 * For example: /blogs/index.php?p=1&more=1&c=1&tb=1&pb=1
 * Note: don't cod ethis URL by hand, use the template functions to generate it!
 *
 * Thanks to mattbta @ http://www.brotherson.com/ for the modifications to 
 * this file (and _lastcomments.php) that give them their nice clean look!
 *
 * b2evolution - {@link http://b2evolution.net/}
 * Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}
 * @copyright (c)2003-2004 by Francois PLANQUE - {@link http://fplanque.net/}
 *
 * @package evoskins
 * @subpackage kubrick2evo
 */

if( !defined('DB_USER') ) die( 'Please, do not access this page directly.' );

if( ! $c ) { // Comments not requested
	$disp_comments = 0; // DO NOT Display the comments if not requested
	$disp_comment_form = 1; // DO NOT Display the comments form if not requested
	}
	
if( ! ($disp_comments || $disp_comment_form  ) ) { // Nothing more to do....
	return false;
	} 
?>

<a name="feedbacks"></a>

<?php

//if( $disp_comments || $disp_trackbacks || $disp_pingbacks  ) {
	

	if( $disp_comment_form ) { // We want to display the comments form: 
		if( $Item->can_comment() ) { // User can leave a comment ?>
			<h2 id="postcomment"><?php echo T_('Leave a comment') ?></h2>
			<h2><?php echo T_('URLs, email, AIM and ICQs will be converted automatically.') ?></h2>
			<?php
			$comment_author = isset($_COOKIE[$cookie_name]) ? trim($_COOKIE[$cookie_name]) : '';
			$comment_author_email = isset($_COOKIE[$cookie_email]) ? trim($_COOKIE[$cookie_email]) : '';
			$comment_author_url = isset($_COOKIE[$cookie_url]) ? trim($_COOKIE[$cookie_url]) : '';
			?>
			<!-- form to add a comment -->
			
			<div>
			<center>
			<table border="1" cellpadding="14" width="85%" class="wws_contenthead">
			<tr>
			<td> 
			<form action="<?php echo $htsrv_url ?>/comment_post.php" method="post" class="wws_content">
			<input type="hidden" name="comment_post_ID" value="<?php $Item->ID() ?>" />
			<input type="hidden" name="redirect_to" value="<?php echo regenerate_url() ?>" />
			<fieldset style="border: none">
			<?php 
			if( is_logged_in() ) { // User is logged in: ?>
				<?php } else { // User is not loggued in: ?>
				<p>
				<label for="author"><?php echo T_('Name :    ') ?></label>
				<input type="text" name="author" id="author" value="<?php echo $comment_author ?>" size="40" tabindex="1" />
				</p>

				<p>
				
				<label for="email"><?php echo T_('E-mail:') ?></label>
				<input type="text" name="email" id="email" value="<?php echo $comment_author_email ?>" size="40" tabindex="2"  />
				</p>

				
				<?php } ?>

			<p>
			<label for="comment"><?php echo T_('Your Comment'); ?></label>
			<br />
			<textarea name="comment" id="comment" cols="140" rows="10" tabindex="4"></textarea>
			</p>

			<p>
			<?php echo T_('Options') ?>:<br />
			<?php if(substr($comments_use_autobr,0,4) == 'opt-') { ?>
				<input type="checkbox" name="comment_autobr" value="1" <?php if($comments_use_autobr == 'opt-out') echo ' checked="checked"' ?> tabindex="6" id="comment_autobr" class="chekbox" /> <label for="comment_autobr"><?php echo T_('Auto-BR') ?></label> <span class="notes">(<?php echo T_('Line breaks become &lt;br /&gt;') ?>)</span><br />
				<?php }
			if( ! is_logged_in() ) { // User is not logged in: ?>
				<input type="checkbox" name="comment_cookies" value="1" checked="checked" tabindex="7" id="comment_cookies" class="chekbox" /> <label for="comment_cookies"><?php echo T_('Remember me') ?></label> <span class="notes"><?php echo T_('(Set cookies for name, email &amp; url)') ?></span>
				<?php } ?>
			</p>
			<form method="post" onclick="javascript: self.close()">
			<INPUT TYPE="Submit" NAME="post" VALUE="Send comment" >
			</form>
			</fieldset>
			</td>
			</tr>
			</table>
			</center>
			</div>
				
			<?php } 
		 ?>

	<?php }
// if you delete this the sky will fall on your head ?>

<form method="GET" action="javascript: self.close()">
	<INPUT TYPE="Submit" NAME="back" VALUE="Back" >

</form>
</body>
</html>
 


Three things that this code is not working as I like:

1-) I would like to close the window when the user press the "Send comment"button. It's now showing the form again. The "Back" button works but not the "Send comment"button.

2-) Both buttons are not showing as buttons but gray boxes.

Other wish:
How can I show "Comment sents successfully"after pressing the "Send comment"button"?

You can see this by visiting my blog [ www.alkhater.net/blog ] and trying to leave a comment

Thank you all in advance.

2 Jan 03, 2006 15:39

The "Send Comment" button actually does close the window. The problem is in /htsrv/comment_post.php, this code is returning the previous window:


param( 'redirect_to', 'string' );
$location = (!empty($redirect_to)) ? $redirect_to : $_SERVER['HTTP_REFERER'];
header( 'Refresh:0;url='.str_replace('&amp;', '&', $location) );


Form is loading...