<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Haiders WebSpace &#187; phpBB</title>
	<atom:link href="http://blog.creativeitp.com/category/posts-and-articles/phpbb/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.creativeitp.com</link>
	<description>Let&#039;s talk about IT</description>
	<lastBuildDate>Fri, 18 Nov 2011 17:36:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Retrieve data as UTF-8 from MySQL DB</title>
		<link>http://blog.creativeitp.com/posts-and-articles/phpbb/retrieve-data-as-utf-8-from-mysql-db/</link>
		<comments>http://blog.creativeitp.com/posts-and-articles/phpbb/retrieve-data-as-utf-8-from-mysql-db/#comments</comments>
		<pubDate>Mon, 02 Mar 2009 15:43:39 +0000</pubDate>
		<dc:creator>Haider al-Khateeb</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[phpBB]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://blog.creativeitp.com/?p=100</guid>
		<description><![CDATA[The image above is showing part of a small hack I coded for a phpBB board to show topics from selected sections. Those question marks were suppose to be Arabic letters, but after a recent update to phpBB the hack failed to use the board config file to connect so I had to set up [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">
<p style="text-align: center;">
<div id="attachment_102" class="wp-caption aligncenter" style="width: 478px"><img src="http://blog.creativeitp.com/wp-content/uploads/2010/01/charset-problem02.jpg" alt="" title="Charset Problem" width="468" height="58" class="size-full wp-image-102" /><p class="wp-caption-text">Charset Problem</p></div>
</p>
<p style="text-align: center;">
<p style="text-align: justify;">The image above is showing part of a small hack I coded for a phpBB board to show topics from selected sections. Those question marks were suppose to be Arabic letters, but after a recent update to phpBB the hack failed to use the board config file to connect so I had to set up my own direct connection to the DB.</p>
</p>
<p style="text-align: justify;">The connection was fine, but I got &#8220;?????&#8221; instead of something I can read in Arabic. After some tests I figured out, though the MySQL DB is using UTF-8 as a character set, which means it can handle the language efficiently, I had to set the character set to UTF-8 via PHP for every query using the following code:</p>
<p style="text-align: justify;">
<p style="text-align: justify;">

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SET CHARACTER SET utf8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

</p>
<p style="text-align: justify;">
<p style="text-align: justify;">What is even better is setting the character set at once with a single line of code for the whole connection by using the following code:</p>
<p><span id="more-100"></span></p>
<p style="text-align: justify;">
<p style="text-align: justify;">

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SET CHARACTER SET 'utf8'&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$db</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

</p>
<p style="text-align: justify;">
<p style="text-align: justify;">This code should be used directly after the connection, as in the following example:</p>
<p style="text-align: justify;">
<p style="text-align: justify;">

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"> <span style="color: #000088;">$db</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'localhost'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'DB_USER'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'DB_PASSWORD'</span><span style="color: #009900;">&#41;</span> 
or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Could not connect&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DB_NAME'</span><span style="color: #339933;">,</span><span style="color: #000088;">$db</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Could not connect&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
  <span style="color: #666666; font-style: italic;">// Set character set to UTF-8</span>
  <span style="color: #666666; font-style: italic;">//</span>
  <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SET CHARACTER SET 'utf8'&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$db</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

</p>
<p style="text-align: justify;">
<p style="text-align: justify;">Now I got my topics in readable Arabic once again!</p>
<p style="text-align: justify;">
<p style="text-align: center;">
<div id="attachment_101" class="wp-caption aligncenter" style="width: 476px"><img src="http://blog.creativeitp.com/wp-content/uploads/2010/01/charset-problem01.jpg" alt="" title="Charset Problem Solved" width="466" height="57" class="size-full wp-image-101" /><p class="wp-caption-text">Charset Problem Solved</p></div>
<p style="text-align: justify;">
]]></content:encoded>
			<wfw:commentRss>http://blog.creativeitp.com/posts-and-articles/phpbb/retrieve-data-as-utf-8-from-mysql-db/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Advanced Quick Reply topic scroll down problem</title>
		<link>http://blog.creativeitp.com/posts-and-articles/phpbb/advanced-quick-reply-topic-scroll-down-problem/</link>
		<comments>http://blog.creativeitp.com/posts-and-articles/phpbb/advanced-quick-reply-topic-scroll-down-problem/#comments</comments>
		<pubDate>Fri, 30 Jan 2009 15:18:52 +0000</pubDate>
		<dc:creator>Haider al-Khateeb</dc:creator>
				<category><![CDATA[phpBB]]></category>

		<guid isPermaLink="false">http://blog.creativeitp.com/?p=91</guid>
		<description><![CDATA[Advanced Quick Reply is a nice phpBB Mod by &#8220;Z3u5&#8243;. I&#8217;ve adopted it for many phpBB boards I developed. However, it got this tiney little problem with IE, where users are taken to the buttom of the page everytime they open a topic to read. You may stop this by taking off: 1 textarea.focus&#40;&#41;; To [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">
<p style="text-align: justify;"><a target="_blank" href="http://www.phpbb.com/community/viewtopic.php?f=69&amp;t=930915">Advanced Quick Reply</a> is a nice phpBB Mod by &#8220;Z3u5&#8243;. I&#8217;ve adopted it for many phpBB boards I developed. However, it got this tiney little problem with IE, where users are taken to the buttom of the page everytime they open a topic to read.</p>
<p></p>
<p style="text-align: justify;">You may stop this by taking off:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">textarea.<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

</p>
<p style="text-align: justify;"><strong></strong></p>
<p style="text-align: justify;">To disable this function, open: <em>styles/&#8230;/template/editor.js</em> within your phpBB3 directory then add the PHP comment tag infront of it as you see bellow:</p>
<p style="text-align: justify;">

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>is_ie <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000066; font-weight: bold;">typeof</span><span style="color: #009900;">&#40;</span>baseHeight<span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #3366CC;">'number'</span><span style="color: #009900;">&#41;</span>
 <span style="color: #009900;">&#123;</span>
  <span style="color: #006600; font-style: italic;">//textarea.focus();</span>
  baseHeight<span style="color: #339933;">=</span>doc.<span style="color: #660066;">selection</span>.<span style="color: #660066;">createRange</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">duplicate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">boundingHeight</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>document.<span style="color: #660066;">forms</span><span style="color: #009900;">&#91;</span>form_name<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
   <span style="color: #009900;">&#123;</span>
   document.<span style="color: #660066;">body</span>.<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

</p>
<p style="text-align: justify;">
]]></content:encoded>
			<wfw:commentRss>http://blog.creativeitp.com/posts-and-articles/phpbb/advanced-quick-reply-topic-scroll-down-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

