Recent Topics

1 Dec 06, 2005 18:53    

I have translated my b2evolutioon blog to arabic and everything works just fine, except the leave a comment.

It produces a scrambled chars.

Please look at any comment and you will see the problem at http://www.alkhater.net/ablog

Thank you all for your help

kskhater
:D

2 Dec 06, 2005 21:47

Please paste the code that you are using in your skin's _main.php to create the "Leave a comment" snippet.

3 Dec 07, 2005 18:53

<?php 
/**
 * This is the main template. It displays the blog.
 *
 * However this file is not meant to be called directly.
 * It is meant to be called automagically by b2evolution.
 * To display a blog, you should call a stub file instead, for example:
 * /blogs/index.php or /blogs/blog_b.php
 *
 * 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.' );

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php locale_lang() ?>" lang="<?php locale_lang() ?>">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php locale_charset() ?>" />
<title><?php
	$Blog->disp('name', 'htmlhead');
	single_cat_title( ' - ', 'htmlhead' );
	single_month_title( ' - ', 'htmlhead' );
	single_post_title( ' - ', 'htmlhead' );
	arcdir_title( ' - ', 'htmlhead' );
	last_comments_title( ' - ', 'htmlhead' );
	stats_title( ' - ', 'htmlhead' );
?>
</title>
<base href="<?php skinbase(); // Base URL for this skin. You need this to fix relative links! ?>" />
<meta name="description" content="<?php $Blog->disp( 'shortdesc', 'htmlattr' ); ?>" />
<meta name="keywords" content="<?php $Blog->disp( 'keywords', 'htmlattr' ); ?>" />
<meta name="MSSmartTagsPreventParsing" content="TRUE" />
<meta http-equiv="imagetoolbar" content="no" />
<?php switch( $disp ) {
	case 'profile':
	case 'stats':
	echo '<meta name="robots" content="noindex, nofollow" />'."\n";
	break;
	case 'arcdir':
	echo '<meta name="robots" content="noindex, follow" />'."\n";
	break;
	}
?>
<meta name="generator" content="b2evolution <?php echo $b2_version ?>" /> <!-- Please leave this for stats -->
<link rel="alternate" type="text/xml" title="RDF" href="<?php $Blog->disp( 'rdf_url', 'raw' ) ?>" />
<link rel="alternate" type="text/xml" title="RSS .92" href="<?php $Blog->disp( 'rss_url', 'raw' ) ?>" />
<link rel="alternate" type="text/xml" title="RSS 2.0" href="<?php $Blog->disp( 'rss2_url', 'raw' ) ?>" />
<link rel="alternate" type="application/atom+xml" title="Atom" href="<?php $Blog->disp( 'atom_url', 'raw' ) ?>" />
<link rel="pingback" href="<?php $Blog->disp( 'pingback_url', 'raw' ) ?>" />
<link rel="stylesheet" type="text/css" media="print" href="print.css" />
<link rel="stylesheet" href="kubrick2evo.css" type="text/css" />
<script type="text/javascript"> function popUp(url){ window.open(url, "pop", "width = 650, height = 420, top = 90, left = 75, toolbar = 0, scrollbars = 1, resizable = 0") } </script>
<script type="text/javascript"> function popUp_sub(url){ window.open(url, "pop", "width = 700, height = 350, top = 90, left = 75, toolbar = 0, scrollbars = 0, resizable = 0") } </script>
<?php /**comments_popup_script($width = 600, $height = 450, $scrollbars = true, $status = true, $resizable = true) // Include javascript to open pop up windows ?>) */
</head>
<body>
<?php if( $disp != 'single' ) {
	echo '<div id="wrapper">';
	} else {
	echo '<div id="wrapperWide">';
	} ?>

<div id="header">
	<h1><a href="<?php $Blog->disp( 'blogurl', 'raw' ) ?>"><?php $Blog->disp( 'name', 'htmlbody' ) ?></a></h1>
	<div class="description"><?php $Blog->disp( 'tagline', 'htmlbody' ) ?></div>
</div>

<?php // BlogListL for aligned left, BlogListC for aligned center, BlogListR for aligned right ?>
<div id="BlogListC">
<?php require( dirname(__FILE__).'/_bloglist.php' ); ?>
</div>

<hr />

<?php if( $disp != 'single' ) {
	echo '<div id="bPosts">';
	} else {
	echo '<div id="bPostsWide">';
	} ?>

<h2 class="pagetitle"><?php
	single_cat_title();
//	single_month_title();
//	single_post_title();
	arcdir_title();
	last_comments_title();
	stats_title();
	profile_title();
?></h2>

<!-- =================================== START OF MAIN AREA =================================== -->
<!-- startprint -->
<?php // --- START OF POSTS ---
if( isset($MainList) ) $MainList->display_if_empty(); // Display message if no post
if( isset($MainList) ) while( $Item = $MainList->get_item() ) {
// $MainList->date_if_changed(); ?>
<div class="bPost" lang="<?php $Item->lang() ?>">
	<?php
	locale_temp_switch( $Item->locale ); // Temporarily switch to post locale
	$Item->anchor(); // Anchor for permalinks to refer to
	?>

<h2><?php 
if( $Item->get('url') ) {
	$Item->title();
	} else { ?>
	<a href="<?php $Item->permalink() ?>" title="<?php echo T_('Permanent link to full entry') ?>"><?php $Item->title( '', '', FALSE ); ?></a>
	<?php } ?>
</h2>

<div class="bSmallHead">
<?php $Item->issue_date('j /  m / Y'); ?> <?php // locale_flag( $Item->locale, 'h10px' ); ?>
</div>

<div class="bText">
	<?php 
	$Item->content();
	link_pages();
    ?>
	</div>
<!-- stopprint -->
<div class="bSmallPrint">
<a href="<?php $Item->permalink() ?>" title="<?php echo T_('Permanent link to full entry') ?>" class="permalink_right"><img src="img/chain_link.gif" alt="<?php echo T_('Permalink') ?>" width="14" height="14" border="0" class="middle" /></a>


<?php $Item->feedback_link( 'comments' ) // Link to comments ?>
<?php $Item->feedback_link( 'trackbacks', ' &bull; ' ) // Link to trackbacks ?>
<?php $Item->feedback_link( 'pingbacks', ' &bull; ' ) // Link to trackbacks ?>
<?php $Item->edit_link( ' &bull; ' ) // Link to backoffice for editing ?>
<?php $Item->trackback_rdf() // trackback autodiscovery information ?> 
&bull
  <a href = "http://www.alkhater.net/ablog/addOns/friend/friend.php?id= <?php $Item -> permalink() ?>" title = " Send "<?php $ttl = $Item -> title; $ttl = str_replace('"', '', $ttl); $ttl=strip_tags($ttl); echo $ttl; ?>" to a Friend " onclick = "javascript:popUp ( 'http://www.alkhater.net/ablog/addOns/friend/friend.php?id=<?php $Item -> permalink() ?>&amp;js=on&amp;p=<?php echo $Item->ID ?>' ); return false" ><img src="http://alkhater.net/ablog/img/icon_mail.gif" alt="<?php echo T_('mail') ?>"/>إرسل هذا المقال</a>
&bull
<?php if( $disp == 'single' ) { 
echo ' <a href="http://www.alkhater.net/ablog/addOns/phprint/phprint.php"><img src="http://alkhater.net/ablog/img/icon_print.gif" alt="';
echo T_('Print');
echo '"/> إطـبـع هذا المقال</a>';
}
else {
	if ($more_file == '') 
		echo 'للطباعة إتبع هذه الحلقة';
} ?>


  </div>

<?php // START OF INCLUDE FOR COMMENTS, TRACKBACK, PINGBACK, ETC.
$disp_comments = 1; // Display comments if requested
$disp_comment_form = 1; // Display comments form if requested
if ( get_bloginfo( 'allowtrackbacks' ) == 1 ) {
    $disp_trackbacks = 1; // Display trackbacks if requested
    $disp_trackback_url = 0; // Display trackback URL if requested
	} else {
	$disp_trackbacks = 0; // or don't
	$disp_trackback_url = 0; // or don't
	}
if ( get_bloginfo( 'allowpingbacks' ) == 1 ) {
	$disp_pingbacks = 1; // Display pingbacks if requested
	} else {
	$disp_pingbacks = 0;
	}
	require( dirname(__FILE__).'/_feedback.php' ); 
	
locale_restore_previous(); // Restore previous locale (Blog locale)
?>
</div>

<?php } // ---------------------------------- END OF POSTS ------------------------------------ ?>

<p class="center"><strong>
	<?php posts_nav_link(); ?>
	<?php 
		// previous_post( '<p class="center">%</p>' );
		// next_post( '<p class="center">%</p>' );
	?>
</strong></p>

<?php // START OF INCLUDES FOR LAST COMMENTS, STATS, ARCHIVE DIRECTORY, PROFILE, FLIGHT LOG
switch( $disp ) {
	case 'arcdir': // this includes the archive directory if requested
	require( dirname(__FILE__).'/_arcdir.php');
	break;
	case 'comments': // this includes the last comments if requested:
	require( dirname(__FILE__).'/_lastcomments.php' );
	break;
	case 'profile': // this includes the profile form if requested
	require( dirname(__FILE__).'/_profile.php');
	break;
	case 'stats': // this includes the statistics if requested:
	require( dirname(__FILE__).'/_stats.php');
	break;
	default:
	} ?>

</div>

<!-- =================================== START OF SIDEBAR =================================== -->

<?php if( $disp != 'single' ) { ?>
<div id="bSideBar">

<div align="center">
<script language="JavaScript" src="EmailLink.js">
<!-- Original:  Happy Smart -->
<!-- Web Site:  http://happysmart.net -->
</script>
</div>

<div class="bSideItem">
	<p><?php $Blog->disp( 'longdesc', 'htmlbody' ); ?></p>
	<div align="center">
	</div>

<br />
<img src="http://alkhater.net/ablog/img/lines_bb_011.gif" alt="LINE">


<br />
<!-- Added by KSK for mailing list -->
<div align="center">
		إشـترك في رسـالـة الأخـبـار
		<FORM onclick="javascript:popUp_sub ( 'http://www.alkhater.net/ablog/under_con.php'); return false" METHOD="POST" ENCTYPE="application/x-www-form-urlencoded">
		<INPUT TYPE="TEXT" NAME="contents" SIZE="18"><br />
		<INPUT TYPE="SUBMIT" NAME="Sign-up" VALUE="إرسـل"><br />
		</form>
</div>
<!-- End of Added by KSK for mailing list -->	

<img src="http://alkhater.net/ablog/img/lines_bb_011.gif" alt="LINE">
<div align="center">
	<a href="http://clustrmaps.com/counter/maps.php?url=http://www.alkhater.net/ablog" id="clustrMapsLink">
	<img src="http://clustrmaps.com/counter/index2.php?url=http://www.alkhater.net/ablog" border=1 alt="Locations of visitors to this page"
	onError="this.onError=null; this.src='http://www.meetomatic.com/images/clustrmaps-back-soon.jpg'; document.getElementById('clustrMapsLink').href='http://clustrmaps.com/'">
	</a>
</div>
<img src="http://alkhater.net/ablog/img/lines_bb_011.gif" alt="LINE">
<br /><br />
<div align="center" id="online">
<!--	<a href="http://www.alkhater.net/ablog/visitors.php" title=" Currently Visiting " alt="users online " onclick = "javascript:popUp_visitors ( 'http://www.alkhater.net/ablog/visitors.php'); return false" ><img src="http://alkhater.net/ablog/img/visitors.gif">الـزوار الـحـالـيـن</a>-->
<?php include("/home/alkhpymg/public_html/blog/addOns/visitors/users.php");?>	
</div>
<br />
<img src="http://alkhater.net/ablog/img/lines_bb_011.gif" alt="LINE">
	<p class="center"><strong><?php posts_nav_link( ' | ', '< '.T_('Previous'), T_('Next').' >' ); ?></strong></p>
	<!--?php next_post(); // activate this if you want a link to the next post in single page mode ?-->
	<!--?php previous_post(); // activate this if you want a link to the previous post in single page mode ?-->
	<?php // require( dirname(__FILE__).'/_calendar.php' ); // uncomment this line for the calendar ?>
	<ul>
	<!-- <li><a href="<?php $Blog->disp( 'lastcommentsurl', 'raw' ) ?>"><strong><?php echo T_('Last comments') ?></strong></a></li>-->
	<li><a href="<?php $Blog->disp( 'blogstatsurl', 'raw' ) ?>"><strong><?php echo T_('Some viewing statistics') ?></strong></a></li>
	</ul>
	</div>
<br />
<div class="bSideItem">
	<h3 class="sideItemTitle"><?php echo T_('Search') ?></h3>
	<?php form_formstart( $Blog->dget( 'blogurl', 'raw' ), 'search', 'SearchForm' ) ?>
	<p><input type="text" name="s" size="30" value="<?php echo htmlspecialchars($s) ?>" class="SearchField" /><br />
	<input type="radio" name="sentence" value="AND" id="sentAND" <?php if( $sentence=='AND' ) echo 'checked="checked" ' ?>/><label for="sentAND"><?php echo T_('All Words') ?></label><br />
	<input type="radio" name="sentence" value="OR" id="sentOR" <?php if( $sentence=='OR' ) echo 'checked="checked" ' ?>/><label for="sentOR"><?php echo T_('Some Word') ?></label><br />
	<input type="radio" name="sentence" value="sentence" id="sentence" <?php if( $sentence=='sentence' ) echo 'checked="checked" ' ?>/><label for="sentence"><?php echo T_('Entire phrase') ?></label></p>
	<input type="submit" name="submit" class="submit" value="<?php echo T_('Search') ?>" />
	</form>
	</div>

<div class="bSideItem">
	<h3><?php echo T_('Archives') ?></h3>
	<ul>
	<?php require( dirname(__FILE__).'/_archives.php' ); // ARCHIVES LIST INCLUDED HERE ?>
	<li><a href="<?php $Blog->disp( 'arcdirurl', 'raw' ) ?>" title="Visit the complete archives"><?php echo T_('more...') ?></a></li>
	</ul>
	</div>

<div class="bSideItem">
	<h3><?php echo T_('Categories') ?></h3>
	<?php form_formstart( $Blog->dget( 'blogurl', 'raw' ) ) ?>
	<?php require( dirname(__FILE__).'/_categories.php' ); // CATEGORIES INCLUDED HERE ?>
	<br />
	<?php if( $cat_line_checkbox ) { ?>
	<input type="submit" class="submit" value="<?php echo T_('Get selection') ?>" />
	<?php } ?>
	</form>
	</div>



<?php if( ! $Blog->get('force_skin') ) {	// Skin switching is allowed for this blog: ?>
<div class="bSideItem">
	<h3><?php echo T_('Choose skin') ?></h3>
	<ul><?php require( dirname(__FILE__).'/_skinslist.php'); // SKINS LIST INCLUDED HERE ?></ul>
	</div>
	<?php } ?>
	
<?php if( FALSE ) { // nice little cheat here! ?>
<?php if ($disp != 'stats') { ?>
<div class="bSideItem">
	<h3><?php echo T_('Recent Referers') ?></h3>
	<?php refererList(5, 'global', 0, 0, 'no', '', ($blog > 1) ? $blog : ''); ?>
	<ul>
	<?php if( count( $res_stats ) ) foreach( $res_stats as $row_stats ) { ?>
	<li><a href="<?php stats_referer() ?>" rel="nofollow"><?php stats_basedomain() ?></a></li>
	<?php } // End stat loop ?>
	<li><a href="<?php $Blog->disp( 'blogstatsurl', 'raw' ) ?>"><?php echo T_('more...') ?></a></li>
	</ul>
	<br />
	<h3><?php echo T_('Top Referers') ?></h3>
	<?php refererList(5, 'global', 0, 0, 'no', 'baseDomain', ($blog > 1) ? $blog : ''); ?>
	<ul>
	<?php if( count( $res_stats ) ) foreach( $res_stats as $row_stats ) { ?>
	<li><a href="<?php stats_referer() ?>" rel="nofollow"><?php stats_basedomain() ?></a></li>
	<?php } // End stat loop ?>
	<li><a href="<?php $Blog->disp( 'blogstatsurl', 'raw' ) ?>"><?php echo T_('more...') ?></a></li>
	</ul>
	</div>
	<?php } ?>
	<?php } // end nice little cheat! ?>

<div class="bSideItem">
	<h3><?php echo T_('Misc') ?></h3>
	<ul>
	<?php 
	user_login_link( '<li>', '</li>' );
	user_register_link( '<li>', '</li>' );
	user_admin_link( '<li>', '</li>' );
	user_profile_link( '<li>', '</li>' );
	user_logout_link( '<li>', '</li>' );
	?>
	</ul>
	</div>

<div class="bSideItem">
	<h3><?php echo T_('Syndicate this blog') ?> <img src="../../img/xml.gif" alt="XML" width="36" height="14" class="middle" /></h3>
	<ul>
	<li><font size="-1">RSS 0.92: </font><a href="<?php $Blog->disp( 'rss_url', 'raw' ) ?>"><?php echo T_('Posts') ?></a>, <a href="<?php $Blog->disp( 'comments_rss_url', 'raw' ) ?>"><?php echo T_('Comments') ?></a></li>
	<li><font size="-1">RSS 1.0: </font><a href="<?php $Blog->disp( 'rdf_url', 'raw' ) ?>"><?php echo T_('Posts') ?></a>, <a href="<?php $Blog->disp( 'comments_rdf_url', 'raw' ) ?>"><?php echo T_('Comments') ?></a></li>
	<li><font size="-1">RSS 2.0: </font><a href="<?php $Blog->disp( 'rss2_url', 'raw' ) ?>"><?php echo T_('Posts') ?></a>, <a href="<?php $Blog->disp( 'comments_rss2_url', 'raw' ) ?>"><?php echo T_('Comments') ?></a></li>
	<li><font size="-1">Atom 0.3: </font><a href="<?php $Blog->disp( 'atom_url', 'raw' ) ?>"><?php echo T_('Posts') ?></a>, <a href="<?php $Blog->disp( 'comments_atom_url', 'raw' ) ?>"><?php echo T_('Comments') ?></a></li>
	</ul><p align='right'>
	<a href="http://fplanque.net/Blog/devblog/2004/01/10/p456" title="External - English">؟<span class="smallerNumbers">RSS</span> مـا هو الـ</a></P>
	</div>
<p>
<?php include("/home/alkhpymg/public_html/ablog/addOns/counter/counter.php"); ?>
</p>
<p class="center">powered by<br />
<a href="http://b2evolution.net/" title="b2evolution home"><img src="../../img/b2evolution_logo_80.gif" alt="b2evolution" width="80" height="17" border="0" class="middle" /></a></p>

</div>

<?php	} ?>

<div id="pageFooter">
<p class="baseline">Original design by <a href="http://binarybonsai.com/kubrick/" title="link to binarybonsai.com/kubrick/">Michael Heilemann</a>, modified for 
<a href="http://b2evolution.net/" title="a blog tool like it oughta be">b2evolution</a> by <a href="http://wonderwinds.com/" title="link to wonderwinds.com/">EdB</a>
<br />Valid 
<a href="http://validator.w3.org/check/referer" title="Valid XHTML 1.0!">XHTML</a> :: 
<a href="http://jigsaw.w3.org/css-validator/" title="Valid CSS!">CSS</a> :: 
<a href="http://feedvalidator.org/check.cgi?url=<?php $Blog->disp( 'rss2_url', 'raw' ) ?>" title="Valid RSS!">RSS</a> :: 
<a href="http://feedvalidator.org/check.cgi?url=<?php $Blog->disp( 'atom_url', 'raw' ) ?>" title="Valid Atom!">Atom</a>
</p>
	
<?php log_hit();	// log the hit on this page
debug_info(); // output debug info if requested ?>
</div>
</div>
</body>
</html>

I hope you can see what the problem is![/code]

4 Dec 07, 2005 23:29

Search for this block:

 <?php $Item->feedback_link( 'comments' ) // Link to comments ?> 
 <?php $Item->feedback_link( 'trackbacks', ' &bull; ' ) // Link to trackbacks ?> 
 <?php $Item->feedback_link( 'pingbacks', ' &bull; ' ) // Link to trackbacks ?> 
 <?php $Item->edit_link( ' &bull; ' ) // Link to backoffice for editing ?> 
 <?php $Item->trackback_rdf() // trackback autodiscovery information ?> 
 &bull 
   <a href = "http://www.alkhater.net/ablog/addOns/friend/friend.php?id= <?php $Item -> permalink() ?>" title = " Send "<?php $ttl = $Item -> title; $ttl = str_replace('"', '', $ttl); $ttl=strip_tags($ttl); echo $ttl; ?>" to a Friend " onclick = "javascript:popUp ( 'http://www.alkhater.net/ablog/addOns/friend/friend.php?id=<?php $Item -> permalink() ?>&amp;js=on&amp;p=<?php echo $Item->ID ?>' ); return false" ><img src="http://alkhater.net/ablog/img/icon_mail.gif" alt="<?php echo T_('mail') ?>"/>إرسل هذا المقال</a> 
 &bull 

and replace "&bull" with "&bull;". You've missed the ";" here.

This was the error I've seen.

The comment link itself is generated by $Item->feedback_link('comment'). Perhaps the translation is broken? But perhaps the enitity issue (explained above) is the cause.

5 Dec 08, 2005 06:29

I don't think the"$bull"has any thing to do with it. It has been like this from the start
before I even touched _main.php.

When I edit the comment in the backoffice and delete those strange garbage chars, and write something iin Arabic, save it. The comment appearin Arabic, OK.

That is puzzling!

6 Dec 08, 2005 22:14

So the error appears when posting a comment from the front office, but not when posting from the back office, right?

Can you please paste one of those "scrambled" comments here?

Does it only occur when the comment is arabic?

7 Dec 09, 2005 10:28

Here is the garbage:

مــــلاحــــــظـــــــة رقــــــــــم 1

Yes this happen only when I post in Arabic.

8 Dec 09, 2005 20:16

Sorry, I have no idea what may cause this.. :-/

9 Dec 20, 2005 10:50

In _class comment.php

Comment the following lines in the fllowing function


function content( $format = 'htmlbody' ) 

	{

		$comment = $this->content;
		//**********************************************************************
        // Next 2 lines commented by KSK for  rendering  arabic text correctly
        //**********************************************************************

		//$comment = str_replace('<trackback />', '', $comment);

		//$comment = str_replace('<pingback />', '', $comment);
		
		$comment = format_to_output( $comment, $format );

		echo $comment;

	}


And to get the comment author correctly change the following function to be like this:


function author( $before = '', $after = '#', $before_user = '', $after_user = '#', 

										$format = 'htmlbody', $makelink = false ) 

	{

		if( $this->author_User !== NULL )

		{ // Author is a user

			if( $after_user == '#' ) $after_user = ' ['.T_('Member').']';

			echo $after_user;
			// Added by KSK to display Arabic correctly
			$author_User = $this->author_User->prefered_name( $format );
			$author_User = format_to_output( $author_User , $format );

			echo $author_User;
			
			echo $before_user;

		}

		else

		{	// Display info recorded at edit time:
			// Commented by KSK
			//if( strlen( $this->author_url ) <= 10 ) $makelink = false;

			if( $after == '#' ) $after = ' ['.T_('Visitor').']';

			echo $before;
			
			// Added by KSK to display Arabic correctly
			$author = $this->author;
			
			$author = format_to_output( $author , $format );

			echo $author;
			// Commented by KSK
			//if( $makelink ) echo '<a href="'.$this->author_url.'">';
			//$this->disp( 'author', $format );
			
			//if( $makelink ) echo '</a>';

			echo $after;

		}

	}


Form is loading...