<?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>codeterrorizer.com</title>
	<atom:link href="http://www.codeterrorizer.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.codeterrorizer.com</link>
	<description>Code Snippets</description>
	<lastBuildDate>Mon, 08 Mar 2010 20:49:06 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Simple example on how to search a list with jQuery</title>
		<link>http://www.codeterrorizer.com/jquery/simple-example-on-how-to-search-a-list-with-jquery</link>
		<comments>http://www.codeterrorizer.com/jquery/simple-example-on-how-to-search-a-list-with-jquery#comments</comments>
		<pubDate>Mon, 08 Mar 2010 20:48:20 +0000</pubDate>
		<dc:creator>Christian Koch</dc:creator>
				<category><![CDATA[jquery]]></category>
		<category><![CDATA[jquery li]]></category>
		<category><![CDATA[match]]></category>
		<category><![CDATA[regexp]]></category>
		<category><![CDATA[replace]]></category>
		<category><![CDATA[search list]]></category>
		<category><![CDATA[search ul]]></category>
		<category><![CDATA[ul li]]></category>

		<guid isPermaLink="false">http://www.codeterrorizer.com/?p=217</guid>
		<description><![CDATA[How to create a simple List Search with basic jQuery Functions.

First we need to create a simple unordered list for this example:

&#60;!DOCTYPE html PUBLIC &#34;-//W3C//DTD HTML 4.01 Transitional//EN&#34; &#34;http://www.w3.org/TR/html4/loose.dtd&#34;&#62;
&#60;html&#62;
&#60;head&#62;
	&#60;meta http-equiv=&#34;Content-Type&#34; content=&#34;text/html; charset=ISO-8859-1&#34;&#62;
	&#60;title&#62;Insert title here&#60;/title&#62;
	&#60;style type=&#34;text/css&#34;&#62;
		body{margin:0;padding:0}
		ul.search-list{list-style:none;margin:0;padding:0}
	&#60;/style&#62;
&#60;/head&#62;
&#60;body&#62;
	&#60;label for=&#34;search&#34;&#62;Search&#60;/label&#62;
	&#60;input type=&#34;text&#34; id=&#34;search&#34; name=&#34;searchword&#34; value=&#34;&#34; /&#62;
	&#60;ul class=&#34;search-list&#34;&#62;
		&#60;li&#62;eins&#60;/li&#62;
		&#60;li&#62;zwei&#60;/li&#62;
		&#60;li&#62;drei&#60;/li&#62;
		&#60;li&#62;vier&#60;/li&#62;
		&#60;li&#62;f&#38;uuml;nf&#60;/li&#62;
		&#60;li&#62;sechs&#60;/li&#62;
	&#60;/ul&#62;
&#60;/body&#62;
&#60;/html&#62;

Add the current jQuery Library into the header part. I use Googles jQuery API Read More


Related posts:<ol><li><a href='http://www.codeterrorizer.com/css-hacks/css-hover-pseudo-class' rel='bookmark' title='Permanent Link: CSS :hover Pseudo Class'>CSS :hover Pseudo Class</a></li><li><a href='http://www.codeterrorizer.com/php/php-class-mail' rel='bookmark' title='Permanent Link: PHP Class Mail'>PHP Class Mail</a></li><li><a href='http://www.codeterrorizer.com/css-hacks/italic-font-style-causes-oversized-divs-in-ie6' rel='bookmark' title='Permanent Link: italic font-style causes oversized divs in IE6'>italic font-style causes oversized divs in IE6</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p>How to create a simple List Search with basic jQuery Functions.</p>
<p><span id="more-217"></span></p>
<p>First we need to create a simple unordered list for this example:</p>
<pre class="brush: xml;">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&gt;
&lt;html&gt;
&lt;head&gt;
	&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=ISO-8859-1&quot;&gt;
	&lt;title&gt;Insert title here&lt;/title&gt;
	&lt;style type=&quot;text/css&quot;&gt;
		body{margin:0;padding:0}
		ul.search-list{list-style:none;margin:0;padding:0}
	&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
	&lt;label for=&quot;search&quot;&gt;Search&lt;/label&gt;
	&lt;input type=&quot;text&quot; id=&quot;search&quot; name=&quot;searchword&quot; value=&quot;&quot; /&gt;
	&lt;ul class=&quot;search-list&quot;&gt;
		&lt;li&gt;eins&lt;/li&gt;
		&lt;li&gt;zwei&lt;/li&gt;
		&lt;li&gt;drei&lt;/li&gt;
		&lt;li&gt;vier&lt;/li&gt;
		&lt;li&gt;f&amp;uuml;nf&lt;/li&gt;
		&lt;li&gt;sechs&lt;/li&gt;
	&lt;/ul&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>Add the current jQuery Library into the header part. I use Googles jQuery API in most of my projects to keep the transfer off my servers. I suggest the same for you if you are looking for performance.</p>
<pre class="brush: jscript;">
	&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&quot;&gt;&lt;/script&gt;
</pre>
<p>To catch all changes from the search field with id &#8220;search&#8221; I am going to bind the the change keyup event to the id.</p>
<pre class="brush: jscript;">
$('#search').bind(&quot;change keyup&quot;, function() {
});
</pre>
<p>Going on I check how many letters the user inserted, this value I set to 2. Play with this as you like.</p>
<pre class="brush: jscript;">
searchWord = $(this).val();
if (searchWord.length &gt; 2) {
}
</pre>
<p>So, I start search the list as soon as the user inserted at least 3 letters.</p>
<p>To finally search the list I loop thru the list with jQuery&#8217;s each function and use their match function on each list item text.</p>
<pre class="brush: jscript;">
$('ul.search-list li').each(function() {
	text = $(this).text();
	if (text.match(searchWord)) {
		// Jipieh found one match, now do something with the current list item.
		// In my case I mark the background of the list item yellow.
		$(this).css('background-color', 'yellow');
	}
});
</pre>
<p>Just using match with the search string will not find case insensitive matches. Simply prepare the statement with RegExp as follows.</p>
<pre class="brush: jscript;">
// 'i' stands for case insensitive
if (text.match(RegExp(searchWord, 'i'))) {
</pre>
<p>Now finally the whole example at once <img src='http://www.codeterrorizer.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<pre class="brush: xml;">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&gt;
&lt;html&gt;
&lt;head&gt;
	&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=ISO-8859-1&quot;&gt;
	&lt;title&gt;Insert title here&lt;/title&gt;
	&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&quot;&gt;&lt;/script&gt;
	&lt;style type=&quot;text/css&quot;&gt;
		body{margin:0;padding:0}
		ul.search-list{list-style:none;margin:0;padding:0}
	&lt;/style&gt;
	&lt;script type=&quot;text/javascript&quot;&gt;
	$(document).ready(function(){
		//$('.search-list')
		$('#search').bind(&quot;change keyup&quot;, function() {
			searchWord = $(this).val();
			if (searchWord.length &gt;= 3) {
				$('ul.search-list li').each(function() {
					text = $(this).text();
					if (text.match(RegExp(searchWord, 'i'))) {
						$(this).css('background-color', 'yellow');
					}
				});
			}
		});
	});
	&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
	&lt;label for=&quot;search&quot;&gt;Search&lt;/label&gt;
	&lt;input type=&quot;text&quot; id=&quot;search&quot; name=&quot;searchword&quot; value=&quot;&quot; /&gt;
	&lt;ul class=&quot;search-list&quot;&gt;
		&lt;li&gt;eins&lt;/li&gt;
		&lt;li&gt;zwei&lt;/li&gt;
		&lt;li&gt;drei&lt;/li&gt;
		&lt;li&gt;vier&lt;/li&gt;
		&lt;li&gt;f&amp;uuml;nf&lt;/li&gt;
		&lt;li&gt;sechs&lt;/li&gt;
	&lt;/ul&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>If this is not enough you also could just wrap the matched subtext with a background, simply change your js:</p>
<pre class="brush: jscript;">
if (searchWord.length &gt;= 1) {
	$('ul.search-list li').each(function(i, data) {
		text = $(this).text();
		if (text.match(RegExp(searchWord, 'i'))) {
			newHTML = text.replace(RegExp(searchWord), '&lt;span style=&quot;background:yellow&quot;&gt;'+searchWord+'&lt;/span&gt;');
			$('ul.search-list li:eq('+i+')').html(newHTML);
		}
	});
}
</pre>
<p>I suggest that in both cases you are also not searching just once, so you have to reset the last search results.<br />
With the first whole list item background example simply add one line:</p>
<pre class="brush: jscript;">
$('#search').bind(&quot;change keyup&quot;, function() {
	searchWord = $(this).val();
	if (searchWord.length &gt;= 1) {
		// this is new <img src='http://www.codeterrorizer.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ... reset background
		$('ul.search-list li').css('background-color', 'white');
			$('ul.search-list li').each(function(i, data) {
			text = $(this).text();
			if (text.match(RegExp(searchWord, 'i'))) {
				$(this).css('background-color', 'yellow');
			}
		});
	}
});
</pre>
<p>With the snippet that just marks the specified search substring do this:</p>
<pre class="brush: jscript;">
$('#search').bind(&quot;change keyup&quot;, function() {
	searchWord = $(this).val();
	if (searchWord.length &gt;= 1) {
		// did it quick and dirty with class
		$('ul.search-list li span.mark-search-result').attr('background-color', 'white');

		$('ul.search-list li').each(function(i, data) {
			text = $(this).text();
			if (text.match(RegExp(searchWord, 'i'))) {
				newHTML = text.replace(RegExp(searchWord), '&lt;span style=&quot;background:yellow&quot; class=&quot;mark-search-result&quot;&gt;'+searchWord+'&lt;/span&gt;');
				$('ul.search-list li:eq('+i+')').html(newHTML);
			}
		});
	}
});
</pre>
<p>So that&#8217;s it, you could ofc ourse hide elemnts that don&#8217;t match and show them again or make whatever you like <img src='http://www.codeterrorizer.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>


<p>Related posts:<ol><li><a href='http://www.codeterrorizer.com/css-hacks/css-hover-pseudo-class' rel='bookmark' title='Permanent Link: CSS :hover Pseudo Class'>CSS :hover Pseudo Class</a></li><li><a href='http://www.codeterrorizer.com/php/php-class-mail' rel='bookmark' title='Permanent Link: PHP Class Mail'>PHP Class Mail</a></li><li><a href='http://www.codeterrorizer.com/css-hacks/italic-font-style-causes-oversized-divs-in-ie6' rel='bookmark' title='Permanent Link: italic font-style causes oversized divs in IE6'>italic font-style causes oversized divs in IE6</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.codeterrorizer.com/jquery/simple-example-on-how-to-search-a-list-with-jquery/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Typo3 Extension Flexform, outsourcing Language Files for your flexform</title>
		<link>http://www.codeterrorizer.com/php/typo3-flexform-outsourcing-language-for-your-flexform</link>
		<comments>http://www.codeterrorizer.com/php/typo3-flexform-outsourcing-language-for-your-flexform#comments</comments>
		<pubDate>Fri, 29 Jan 2010 16:17:53 +0000</pubDate>
		<dc:creator>Christian Koch</dc:creator>
				<category><![CDATA[Flexform]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[t3 extension development]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[typo3]]></category>

		<guid isPermaLink="false">http://www.codeterrorizer.com/?p=211</guid>
		<description><![CDATA[Maybe you have seen it in my last short tutorial &#8220;Typo3 Extension Flexform onchange reload&#8221; and wondered what I am doing there with

&#60;sheetTitle&#62;LLL:EXT:extension/res/lang/flexform.xml:sheet_general&#60;/sheetTitle&#62;


What I am doing there is simple, I put all my translations in a different folder in res/lib/flexform.xml under my Exteion directory.
flexform.xml looks just like every other language.xml:

&#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34; standalone=&#34;yes&#34; ?&#62;
&#60;T3locallang&#62;
  Read More


Related posts:<ol><li><a href='http://www.codeterrorizer.com/php/typo3-extension-flexform-onchange-reload' rel='bookmark' title='Permanent Link: Typo3 Extension Flexform onchange reload'>Typo3 Extension Flexform onchange reload</a></li><li><a href='http://www.codeterrorizer.com/jquery/simple-example-on-how-to-search-a-list-with-jquery' rel='bookmark' title='Permanent Link: Simple example on how to search a list with jQuery'>Simple example on how to search a list with jQuery</a></li><li><a href='http://www.codeterrorizer.com/php/php-class-mail' rel='bookmark' title='Permanent Link: PHP Class Mail'>PHP Class Mail</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p>Maybe you have seen it in my last short tutorial &#8220;<a href="http://www.codeterrorizer.com/php/typo3-extension-flexform-onchange-reload" title="Typo3 Extension Flexform onchange reload">Typo3 Extension Flexform onchange reload</a>&#8221; and wondered what I am doing there with</p>
<pre class="brush: xml;">
&lt;sheetTitle&gt;LLL:EXT:extension/res/lang/flexform.xml:sheet_general&lt;/sheetTitle&gt;
</pre>
<p><span id="more-211"></span></p>
<p>What I am doing there is simple, I put all my translations in a different folder in res/lib/flexform.xml under my Exteion directory.</p>
<p>flexform.xml looks just like every other language.xml:</p>
<pre class="brush: xml;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; standalone=&quot;yes&quot; ?&gt;
&lt;T3locallang&gt;
        &lt;meta type=&quot;array&quot;&gt;
                &lt;type&gt;module&lt;/type&gt;
                &lt;description&gt;&lt;/description&gt;
        &lt;/meta&gt;
        &lt;data type=&quot;array&quot;&gt;
                &lt;languageKey index=&quot;default&quot; type=&quot;array&quot;&gt;
                        &lt;label index=&quot;options&quot;&gt;Options&lt;/label&gt;
                        &lt;label index=&quot;backgroundImage&quot;&gt;Background image&lt;/label&gt;
                &lt;/languageKey&gt;
                &lt;languageKey index=&quot;de&quot; type=&quot;array&quot;&gt;
                        &lt;label index=&quot;options&quot;&gt;Optionen&lt;/label&gt;
                        &lt;label index=&quot;backgroundImage&quot;&gt;Hintergrund Bild&lt;/label&gt;
                &lt;/languageKey&gt;
        &lt;/data&gt;
&lt;/T3locallang&gt;
</pre>


<p>Related posts:<ol><li><a href='http://www.codeterrorizer.com/php/typo3-extension-flexform-onchange-reload' rel='bookmark' title='Permanent Link: Typo3 Extension Flexform onchange reload'>Typo3 Extension Flexform onchange reload</a></li><li><a href='http://www.codeterrorizer.com/jquery/simple-example-on-how-to-search-a-list-with-jquery' rel='bookmark' title='Permanent Link: Simple example on how to search a list with jQuery'>Simple example on how to search a list with jQuery</a></li><li><a href='http://www.codeterrorizer.com/php/php-class-mail' rel='bookmark' title='Permanent Link: PHP Class Mail'>PHP Class Mail</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.codeterrorizer.com/php/typo3-flexform-outsourcing-language-for-your-flexform/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Typo3 Extension Flexform onchange reload</title>
		<link>http://www.codeterrorizer.com/php/typo3-extension-flexform-onchange-reload</link>
		<comments>http://www.codeterrorizer.com/php/typo3-extension-flexform-onchange-reload#comments</comments>
		<pubDate>Fri, 29 Jan 2010 16:05:16 +0000</pubDate>
		<dc:creator>Christian Koch</dc:creator>
				<category><![CDATA[Flexform]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[t3 extension development]]></category>
		<category><![CDATA[onchange]]></category>
		<category><![CDATA[reload]]></category>
		<category><![CDATA[typo3]]></category>

		<guid isPermaLink="false">http://www.codeterrorizer.com/?p=206</guid>
		<description><![CDATA[You want your typo flexform to reload after the backend user selects something.

Add the reload before your config Tag:

&#60;T3DataStructure&#62;
  &#60;sheets&#62;
    &#60;sDEF&#62;
      &#60;ROOT&#62;
        &#60;TCEforms&#62;
          &#60;sheetTitle&#62;LLL:EXT:extension/res/lang/flexform.xml:sheet_general&#60;/sheetTitle&#62;
       Read More


Related posts:<ol><li><a href='http://www.codeterrorizer.com/php/typo3-flexform-outsourcing-language-for-your-flexform' rel='bookmark' title='Permanent Link: Typo3 Extension Flexform, outsourcing Language Files for your flexform'>Typo3 Extension Flexform, outsourcing Language Files for your flexform</a></li><li><a href='http://www.codeterrorizer.com/php/determine-a-file-extension-using-php' rel='bookmark' title='Permanent Link: Determine a File Extension Using PHP'>Determine a File Extension Using PHP</a></li><li><a href='http://www.codeterrorizer.com/php/php-ms-sql-odbc-on-debian' rel='bookmark' title='Permanent Link: PHP MS SQL ODBC on Debian'>PHP MS SQL ODBC on Debian</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p>You want your typo flexform to reload after the backend user selects something.</p>
<p><span id="more-206"></span><br />
Add the <onChange>reload</onChange> before your config Tag:</p>
<pre class="brush: xml;">
&lt;T3DataStructure&gt;
  &lt;sheets&gt;
    &lt;sDEF&gt;
      &lt;ROOT&gt;
        &lt;TCEforms&gt;
          &lt;sheetTitle&gt;LLL:EXT:extension/res/lang/flexform.xml:sheet_general&lt;/sheetTitle&gt;
        &lt;/TCEforms&gt;
        &lt;type&gt;array&lt;/type&gt;
        &lt;el&gt;
          &lt;topCategory&gt;
            &lt;TCEforms&gt;
              &lt;label&gt;LLL:EXT:extension/res/lang/flexform.xml:topCategory&lt;/label&gt;
              &lt;onChange&gt;reload&lt;/onChange&gt;
              &lt;config&gt;
                &lt;type&gt;group&lt;/type&gt;
                &lt;internal_type&gt;db&lt;/internal_type&gt;
                &lt;allowed&gt;pages&lt;/allowed&gt;
                &lt;size&gt;1&lt;/size&gt;
                &lt;minitems&gt;1&lt;/minitems&gt;
                &lt;maxitems&gt;1&lt;/maxitems&gt;
              &lt;/config&gt;
            &lt;/TCEforms&gt;
          &lt;/topCategory&gt;
        &lt;/el&gt;
      &lt;/ROOT&gt;
    &lt;/sDEF&gt;
  &lt;/sheets&gt;
&lt;/T3DataStructure&gt;
</pre>


<p>Related posts:<ol><li><a href='http://www.codeterrorizer.com/php/typo3-flexform-outsourcing-language-for-your-flexform' rel='bookmark' title='Permanent Link: Typo3 Extension Flexform, outsourcing Language Files for your flexform'>Typo3 Extension Flexform, outsourcing Language Files for your flexform</a></li><li><a href='http://www.codeterrorizer.com/php/determine-a-file-extension-using-php' rel='bookmark' title='Permanent Link: Determine a File Extension Using PHP'>Determine a File Extension Using PHP</a></li><li><a href='http://www.codeterrorizer.com/php/php-ms-sql-odbc-on-debian' rel='bookmark' title='Permanent Link: PHP MS SQL ODBC on Debian'>PHP MS SQL ODBC on Debian</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.codeterrorizer.com/php/typo3-extension-flexform-onchange-reload/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php.ini short tag in newer PHP versions disabled</title>
		<link>http://www.codeterrorizer.com/php/php-ini-short-tag-in-newer-php-versions-disabled</link>
		<comments>http://www.codeterrorizer.com/php/php-ini-short-tag-in-newer-php-versions-disabled#comments</comments>
		<pubDate>Mon, 11 Jan 2010 12:15:01 +0000</pubDate>
		<dc:creator>Christian Koch</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[php.ini]]></category>
		<category><![CDATA[short tag]]></category>
		<category><![CDATA[short_open_tag]]></category>
		<category><![CDATA[tag]]></category>

		<guid isPermaLink="false">http://www.codeterrorizer.com/?p=204</guid>
		<description><![CDATA[Simply enable short Tag&#8217;s like 


Related posts:<ol><li><a href='http://www.codeterrorizer.com/php/turn-off-deprecated-warnings' rel='bookmark' title='Permanent Link: Turn off Deprecated Warnings'>Turn off Deprecated Warnings</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p>Simply enable short Tag&#8217;s like <? with:</p>
<p>short_open_tag = On</p>


<p>Related posts:<ol><li><a href='http://www.codeterrorizer.com/php/turn-off-deprecated-warnings' rel='bookmark' title='Permanent Link: Turn off Deprecated Warnings'>Turn off Deprecated Warnings</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.codeterrorizer.com/php/php-ini-short-tag-in-newer-php-versions-disabled/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP MS SQL ODBC on Debian</title>
		<link>http://www.codeterrorizer.com/php/php-ms-sql-odbc-on-debian</link>
		<comments>http://www.codeterrorizer.com/php/php-ms-sql-odbc-on-debian#comments</comments>
		<pubDate>Fri, 06 Nov 2009 10:01:43 +0000</pubDate>
		<dc:creator>Christian Koch</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[ms sql]]></category>
		<category><![CDATA[mssql]]></category>
		<category><![CDATA[odbc]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://www.codeterrorizer.com/?p=195</guid>
		<description><![CDATA[Short introduction on how to establish a MS SQL Server connection with PHP on Debian.

Install FreeTDS on Debian for PHP ODBC. Login as root.
First check if PHP&#8217;s ODBC extension is installed. If not install it with:

apt-get install php5-odbc

Install FreeTDS ODBC:

apt-get install tdsodbc

Don&#8217;t forget to restart your Apache after installing additional PHP extensions.

/etc/init.d/apache restart

Now we can Read More


No related posts.]]></description>
			<content:encoded><![CDATA[<p>Short introduction on how to establish a MS SQL Server connection with PHP on Debian.<br />
<span id="more-195"></span><br />
Install FreeTDS on Debian for PHP ODBC. Login as root.</p>
<p>First check if PHP&#8217;s ODBC extension is installed. If not install it with:</p>
<pre class="brush: bash;">
apt-get install php5-odbc
</pre>
<p>Install FreeTDS ODBC:</p>
<pre class="brush: bash;">
apt-get install tdsodbc
</pre>
<p>Don&#8217;t forget to restart your Apache after installing additional PHP extensions.</p>
<pre class="brush: bash;">
/etc/init.d/apache restart
</pre>
<p>Now we can test a connection to MS SQL Server.</p>
<pre class="brush: php;">
&lt;?php
$con = odbc_connect('Driver=FreeTDS;Server=IPTOMSSQLSERVER;Port=1433;Database=MyDatabase', 'databaseUser', 'databasePassword') or die(&quot;ups cannot connect LALA&quot;);

// do your stuff

odbc_close($con);
?&gt;
</pre>
<p>That&#8217;s it HF</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.codeterrorizer.com/php/php-ms-sql-odbc-on-debian/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>italic font-style causes oversized divs in IE6</title>
		<link>http://www.codeterrorizer.com/css-hacks/italic-font-style-causes-oversized-divs-in-ie6</link>
		<comments>http://www.codeterrorizer.com/css-hacks/italic-font-style-causes-oversized-divs-in-ie6#comments</comments>
		<pubDate>Thu, 05 Nov 2009 13:15:32 +0000</pubDate>
		<dc:creator>Andrea Hildebrand</dc:creator>
				<category><![CDATA[Css Hacks]]></category>

		<guid isPermaLink="false">http://www.codeterrorizer.com/?p=188</guid>
		<description><![CDATA[Block elements containing italic text are displayed expanded in IE6.
As a result, two parallel floating containers can not be displayed side by side in case the specified overall width has been exceeded.
As a solution, the following extra style has to be added to the block element containing the italic font-style:

.italic-container{
	zoom:1;
	overflow: visible
}



Related posts:CSS :hover Pseudo ClassMin-Height Read More


Related posts:<ol><li><a href='http://www.codeterrorizer.com/css-hacks/css-hover-pseudo-class' rel='bookmark' title='Permanent Link: CSS :hover Pseudo Class'>CSS :hover Pseudo Class</a></li><li><a href='http://www.codeterrorizer.com/css-hacks/min-height-for-ie' rel='bookmark' title='Permanent Link: Min-Height for IE'>Min-Height for IE</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p>Block elements containing italic text are displayed expanded in IE6.</p>
<p><span id="more-188"></span>As a result, two parallel floating containers can not be displayed side by side in case the specified overall width has been exceeded.</p>
<p>As a solution, the following extra style has to be added to the block element containing the italic font-style:</p>
<pre class="brush: css; tab-size: 2;">
.italic-container{
	zoom:1;
	overflow: visible
}
</pre>


<p>Related posts:<ol><li><a href='http://www.codeterrorizer.com/css-hacks/css-hover-pseudo-class' rel='bookmark' title='Permanent Link: CSS :hover Pseudo Class'>CSS :hover Pseudo Class</a></li><li><a href='http://www.codeterrorizer.com/css-hacks/min-height-for-ie' rel='bookmark' title='Permanent Link: Min-Height for IE'>Min-Height for IE</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.codeterrorizer.com/css-hacks/italic-font-style-causes-oversized-divs-in-ie6/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fast SQLite Tutorial</title>
		<link>http://www.codeterrorizer.com/sqlite/fast-sqlite-tutorial</link>
		<comments>http://www.codeterrorizer.com/sqlite/fast-sqlite-tutorial#comments</comments>
		<pubDate>Fri, 23 Oct 2009 20:32:34 +0000</pubDate>
		<dc:creator>Christian Koch</dc:creator>
				<category><![CDATA[SQLite]]></category>
		<category><![CDATA[create]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[drop]]></category>
		<category><![CDATA[insert]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.codeterrorizer.com/?p=181</guid>
		<description><![CDATA[here a short introduction to SQLite 3. Have Fun!

Open database, if database does not exist it will be created

C:\test&#62; sqlite4 mydatabase.db

Show help
&#60;/em&#62;
sqlite&#62; .help

Show databases

sqlite&#62; .databases

Show tables

sqlite&#62; .tables

Show create statement for table

sqlite&#62; .schema tablename

Quit SQLite

sqlite&#62; .quit

or

sqlite&#62; .exit

Create table as used to in SQL

C:\test&#62; sqlite4 mydatabase.db
sqlite&#62; CREATE TABLE username (id INTEGER PRIMARY KEY, username VARCHAR(120), password TEXT, Read More


Related posts:<ol><li><a href='http://www.codeterrorizer.com/php/function-subwords-gets-words-by-max-string-length' rel='bookmark' title='Permanent Link: Function subwords, gets words by max string length'>Function subwords, gets words by max string length</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p>here a short introduction to SQLite 3. Have Fun!</p>
<p><span id="more-181"></span></p>
<p><em><strong>Open database, if database does not exist it will be created</strong></em></p>
<pre class="brush: bash;">
C:\test&gt; sqlite4 mydatabase.db
</pre>
<p><strong><em>Show help</em></strong></p>
<pre class="brush: bash;">&lt;/em&gt;
sqlite&gt; .help
</pre>
<p><strong><em>Show databases</em></strong></p>
<pre class="brush: bash;">
sqlite&gt; .databases
</pre>
<p><strong><em>Show tables</em></strong></p>
<pre class="brush: bash;">
sqlite&gt; .tables
</pre>
<p><strong><em>Show create statement for table</em></strong></p>
<pre class="brush: bash;">
sqlite&gt; .schema tablename
</pre>
<p><strong><em>Quit SQLite</em></strong></p>
<pre class="brush: bash;">
sqlite&gt; .quit
</pre>
<p>or</p>
<pre class="brush: bash;">
sqlite&gt; .exit
</pre>
<p><strong><em>Create table as used to in SQL</em></strong></p>
<pre class="brush: bash;">
C:\test&gt; sqlite4 mydatabase.db
sqlite&gt; CREATE TABLE username (id INTEGER PRIMARY KEY, username VARCHAR(120), password TEXT, firstname VARCHAR(120), lastname VARCHAR(120), email VARCHAR(250));
sqlite&gt; .tables
username
</pre>
<p><strong><em>Drop table</em></strong></p>
<pre class="brush: bash;">
sqlite&gt; DROP TABLE username;
sqlite&gt; .tables
sqlite&gt;
</pre>
<p><strong><em>Insert</em></strong></p>
<pre class="brush: bash;">
sqlite&gt; CREATE TABLE username (id INTEGER PRIMARY KEY, username VARCHAR(120), password TEXT, firstname VARCHAR(120), lastname VARCHAR(120), email VARCHAR(250));
sqlite&gt; INSERT INTO username (username, firstname, lastname, email) VALUES (&quot;Christian.Koch&quot;, &quot;Christian&quot;, &quot;Koch&quot;, &quot;blubb@blubbblubb.net&quot;);
</pre>
<p><strong><em>Select</em></strong></p>
<pre class="brush: bash;">
sqlite&gt; SELECT * FROM username;
1|Christian.Koch||Christian|Koch|blubb@blubbblubb.net
sqlite&gt;
</pre>
<p>You actually do not need to open the sqlite shell. All commands from SQLite and SQL can be send from comandline.</p>
<pre class="brush: bash;">
C:\test&gt; sqlite3 mydatabase.db &quot;SELECT * FROM username;&quot;
1|Christian.Koch||Christian|Koch|blubb@blubbblubb.net

C:\test&gt;
</pre>
<p><strong><em>Creating a dump</em></strong></p>
<pre class="brush: bash;">
C:\test&gt; sqlite3 mydatabase.db &quot;.dump&quot;
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE username (id INTEGER PRIMARY KEY, username VARCHAR(120), password TEXT, firstname VARCHAR(120), lastname VARCHAR(120), email VARCHAR(250)
);
INSERT INTO &quot;username&quot; VALUES(1,'Christian.Koch',NULL,'Christian','Koch','blubb@blubbblubb.net');
COMMIT;

C:\test&gt;
</pre>
<p><strong><em>Backup the dump</em></strong></p>
<pre class="brush: bash;">
C:\test&gt; sqlite3 mydatabase.db &quot;.dump&quot; &gt; backup.sql
</pre>
<p><strong><em>Create new database from dump</em></strong></p>
<pre class="brush: bash;">
C:\test&gt; sqlite3 newdatabase.db &lt; backup.sql
C:\test&gt; sqlite3 newdatabase.db &quot;.dump&quot;
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE username (id INTEGER PRIMARY KEY, username VARCHAR(120), password TEXT, firstname VARCHAR(120), lastname VARCHAR(120), email VARCHAR(250)
);
INSERT INTO &quot;username&quot; VALUES(1,'Christian.Koch',NULL,'Christian','Koch','blubb@blubbblubb.net');
COMMIT;

C:\test&gt;
</pre>


<p>Related posts:<ol><li><a href='http://www.codeterrorizer.com/php/function-subwords-gets-words-by-max-string-length' rel='bookmark' title='Permanent Link: Function subwords, gets words by max string length'>Function subwords, gets words by max string length</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.codeterrorizer.com/sqlite/fast-sqlite-tutorial/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>cURL: a quick intro</title>
		<link>http://www.codeterrorizer.com/commands/curl-fast-intro</link>
		<comments>http://www.codeterrorizer.com/commands/curl-fast-intro#comments</comments>
		<pubDate>Mon, 19 Oct 2009 13:08:52 +0000</pubDate>
		<dc:creator>Christian Koch</dc:creator>
				<category><![CDATA[Commands]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[domain]]></category>
		<category><![CDATA[practical]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[spoof]]></category>
		<category><![CDATA[url]]></category>

		<guid isPermaLink="false">http://www.codeterrorizer.com/?p=177</guid>
		<description><![CDATA[Here you can find a short practical intro to cURL.

 cURL
Show website.
curl www.mydomain.com
Sending post
curl -d &#8220;name1=value1&#38;name2=value2&#8243; www.mydomain.com
Save output in a file
curl -o out.txt www.mydomain.com
Spoof the Referer
curl -e www.here-i-am-from.com www.mydomain.com
Spoof  User Agent
curl -A &#8216;SuperGC Microsoft 7.5&#8242; www.mydomain.com
Spoof Cookies
curl -b =&#8221;name=value&#8221; www.mydomain.com
Catch and use Cookies
curl &#8211;dump-header header www.mydomain.com
curl -b header www.mydomain.com
curl -c cookies.txt www.mydomain.com
curl -b cookies.txt -c Read More


Related posts:<ol><li><a href='http://www.codeterrorizer.com/php/twitter-curl-found-in-the-net-with-some-changes' rel='bookmark' title='Permanent Link: Twitter CURL (found in the net, with some changes)'>Twitter CURL (found in the net, with some changes)</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p>Here you can find a short practical intro to cURL.<br />
<span id="more-177"></span><br />
<strong> cURL</strong></p>
<p><strong><em>Show website.</em></strong><br />
curl www.mydomain.com</p>
<p><strong><em>Sending post</em></strong><br />
curl -d &#8220;name1=value1&amp;name2=value2&#8243; www.mydomain.com</p>
<p><strong><em>Save output in a file</em></strong><br />
curl -o out.txt www.mydomain.com</p>
<p><strong><em>Spoof the Referer</em></strong><br />
curl -e www.here-i-am-from.com www.mydomain.com</p>
<p><strong><em>Spoof  User Agent</em></strong><br />
curl -A &#8216;SuperGC Microsoft 7.5&#8242; www.mydomain.com</p>
<p><em><strong>Spoof Cookies</strong></em><br />
curl -b =&#8221;name=value&#8221; www.mydomain.com</p>
<p><em><strong>Catch and use Cookies</strong></em><br />
curl &#8211;dump-header header www.mydomain.com<br />
curl -b header www.mydomain.com</p>
<p>curl -c cookies.txt www.mydomain.com<br />
curl -b cookies.txt -c cookies.txt www.mydomain.com</p>
<p><em><strong>cURL Timing</strong></em><br />
Abort if to slow, if you do not download 300 bytes (-Y) every seconds for one minute, 60 seconds (-y) then stop download<br />
curl -Y 300 -y 60 www.mydomain.com</p>
<p><em><strong>Set overall timelimit with -m</strong></em><br />
curl -m 10 www.mydomain.com</p>
<p><strong><em>Limit the transferrate per second</em></strong><br />
curl &#8211;limit-rate 10K www.mydomain.com (same as)<br />
curl &#8211;limit-rate 10240 www.mydomain.com</p>
<p><strong><em>Prevent cURL from upload (-T upload) in a packet size (&#8211;limit-rate) of 1 mb per second</em></strong><br />
curl -T upload.file www.mydomain.com</p>
<p><strong><em>Setting Headers</em></strong><br />
curl -H &#8220;Balbla: This is the value <img src='http://www.codeterrorizer.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> &#8221; www.mydomain.com</p>
<p>Prevent to send specific headers with -H &#8220;name:&#8221;<br />
curl -H &#8220;host:&#8221; www.mydomain.com</p>


<p>Related posts:<ol><li><a href='http://www.codeterrorizer.com/php/twitter-curl-found-in-the-net-with-some-changes' rel='bookmark' title='Permanent Link: Twitter CURL (found in the net, with some changes)'>Twitter CURL (found in the net, with some changes)</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.codeterrorizer.com/commands/curl-fast-intro/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Class Mail</title>
		<link>http://www.codeterrorizer.com/php/php-class-mail</link>
		<comments>http://www.codeterrorizer.com/php/php-class-mail#comments</comments>
		<pubDate>Mon, 19 Oct 2009 12:51:58 +0000</pubDate>
		<dc:creator>Christian Koch</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[attachment]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[oop]]></category>
		<category><![CDATA[text]]></category>

		<guid isPermaLink="false">http://www.codeterrorizer.com/?p=175</guid>
		<description><![CDATA[With this E-Mail Class you can send Plain Text, HTML and attach Files via Web-URL. Mixed E-Mail Text/HTML with/without Attachment are also possible.


&#60;?php

/**
 * This script is part of the newsletter module.
 * Library for mailing.
 *
 * @author Christian Koch &#60;c.koch@chriskoch.net&#62;
 * @copyright Christian Koch &#60;c.koch@chriskoch.net&#62;
 */
class Mail {
	/**
	 * Mail recipient.
	 *
	 * Read More


Related posts:<ol><li><a href='http://www.codeterrorizer.com/php/function-subwords-gets-words-by-max-string-length' rel='bookmark' title='Permanent Link: Function subwords, gets words by max string length'>Function subwords, gets words by max string length</a></li><li><a href='http://www.codeterrorizer.com/php/twitter-curl-found-in-the-net-with-some-changes' rel='bookmark' title='Permanent Link: Twitter CURL (found in the net, with some changes)'>Twitter CURL (found in the net, with some changes)</a></li><li><a href='http://www.codeterrorizer.com/jquery/simple-example-on-how-to-search-a-list-with-jquery' rel='bookmark' title='Permanent Link: Simple example on how to search a list with jQuery'>Simple example on how to search a list with jQuery</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p>With this E-Mail Class you can send Plain Text, HTML and attach Files via Web-URL. Mixed E-Mail Text/HTML with/without Attachment are also possible.</p>
<p><span id="more-175"></span></p>
<pre class="brush: php;">
&lt;?php

/**
 * This script is part of the newsletter module.
 * Library for mailing.
 *
 * @author Christian Koch &lt;c.koch@chriskoch.net&gt;
 * @copyright Christian Koch &lt;c.koch@chriskoch.net&gt;
 */
class Mail {
	/**
	 * Mail recipient.
	 *
	 * @var string
	 */
	private $strMailRecipient = '';

	/**
	 * Mail sender.
	 *
	 * @var string
	 */
	private $strMailSender = '';

	/**
	 * Mail reply to.
	 *
	 * @var string
	 */
	private $strMailReplyTo = '';

	/**
	 * Mail subject.
	 *
	 * @var string
	 */
	private $strMailSubject = '';

	/**
	 * Mail palintext message.
	 *
	 * @var string
	 */
	private $strMailPlainText = '';

	/**
	 * Mail HTML message.
	 *
	 * @var string
	 */
	private $strMailHTML = '';

	/**
	 * Array with attachment paths.
	 *
	 * @return array
	 */
	private $arrAttachment = array();

	/**
	 * Encoding type, by default UTF-8.
	 *
	 * @var string
	 */
	private $strEncoding = 'UTF-8';

	public function __construct() {}

	/**
	 * Set attachment path.
	 *
	 * @param string $strFile
	 * @param string $strName
	 * @param string $strMime
	 */
	public function setAttachment($strFile, $strName, $strMime) {
		$this-&gt;arrAttachment[] = array(
			'file' =&gt; $strFile,
			'name' =&gt; $strName,
			'mime' =&gt; $strMime
		);
	}

	/**
	 * Set encoding.
	 *
	 * @param string $str
	 */
	public function setEncoding($str) {
		$this-&gt;strEncoding = $str;
	}

	/**
	 * Set mail html message.
	 *
	 * @param string $str
	 */
	public function setMailHTML($str) {
		$this-&gt;strMailHTML = $str;
	}

	/**
	 * Set mail subject.
	 *
	 * @param string $str
	 */
	public function setMailPlainText($str) {
		$str = strip_tags($str);

		$this-&gt;strMailPlainText = $str;
	}

	/**
	 * Set mail subject.
	 *
	 * @param string $str
	 */
	public function setMailSubject($str) {
		$str = strip_tags($str);

		$this-&gt;strMailSubject = $str;
	}

	/**
	 * Set mail sender address.
	 *
	 * @param string $str
	 */
	public function setMailRecipient($str) {
		$this-&gt;strMailRecipient = $str;
	}

	/**
	 * Get mail sender address.
	 *
	 */
	public function getMailRecipient() {
		return $this-&gt;strMailRecipient;
	}

	/**
	 * Set mail sender address.
	 *
	 * @param string $str
	 */
	public function setMailSender($str) {
		$this-&gt;strMailSender = $str;
	}

	/**
	 * Get mail sender address.
	 *
	 */
	public function getMailSender() {
		return $this-&gt;strMailSender;
	}

	/**
	 * Set mail reply to address.
	 *
	 * @param string $str
	 */
	public function setMailReplyTo($str) {
		$this-&gt;strMailReplyTo = $str;
	}

	/**
	 * Get mail reply to address.
	 *
	 * @return string
	 */
	public function getMailReplyTo() {
		if (empty($this-&gt;strMailReplyTo)) {
			$this-&gt;strMailReplyTo = substr_replace(
				$this-&gt;strMailSender,
				'noreply',
				0,
				strpos($this-&gt;strMailSender, '@'));
		}

		return $this-&gt;strMailReplyTo;
	}

	/**
	 * Send email.
	 *
	 */
	public function send() {
		$strMessageSeperator = $this-&gt;getMailSeperator();

		$strMailHeader = $this-&gt;getStdMailHeader();
		$strMailHeader .= &quot;MIME-Version: 1.0\n&quot;;
		$strMailHeader .= count($this-&gt;arrAttachment) &gt; 0 ? &quot;Content-Type: multipart/mixed; &quot; : &quot;Content-Type: multipart/alternative; &quot;;
		$strMailHeader .= &quot;boundary=\&quot;{$strMessageSeperator}\&quot;\n\n&quot;;

		if (!empty($this-&gt;strMailHTML) &amp;&amp; !empty($this-&gt;strMailPlainText)) {
			$strAlternativeMessageSeperator = $this-&gt;getMailSeperator();

			$strMailMessage = &quot;--{$strMessageSeperator}\n&quot;;
			$strMailMessage .= &quot;Content-Type: multipart/alternative; boundary=\&quot;$strAlternativeMessageSeperator\&quot;\n\n&quot;;
			$strMailMessage .= &quot;--$strAlternativeMessageSeperator\n&quot;;
			$strMailMessage .= $this-&gt;getPreparedMailPlainText();
			$strMailMessage .= &quot;--$strAlternativeMessageSeperator\n&quot;;
			$strMailMessage .= $this-&gt;getPreparedMailHTML();
			$strMailMessage .= &quot;--$strAlternativeMessageSeperator--\n&quot;;
		} else if (!empty($this-&gt;strMailPlainText)) {
			$strMailMessage = &quot;--{$strMessageSeperator}\n&quot;;
			$strMailMessage = $this-&gt;getPreparedMailPlainText();
		} else if (!empty($this-&gt;strMailHTML)) {
			$strMailMessage = &quot;--{$strMessageSeperator}\n&quot;;
			$strMailMessage .= $this-&gt;getPreparedMailHTML();
		}

		for ($i=0; $i&lt;count($this-&gt;arrAttachment); $i++) {
			if (ini_get('allow_url_fopen') == '1') {
				$strFileContents = file_get_contents($this-&gt;arrAttachment[$i]['file']);
			} else {
				if (function_exists('curl_init')) {
					$ch = curl_init();
					curl_setopt($ch, CURLOPT_URL, $this-&gt;arrAttachment[$i]['file']);
					curl_setopt($ch, CURLOPT_HEADER, 0);
					curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
					curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0');
					$strFileContents = curl_exec($ch);
					curl_close($ch);
				}
			}

			$strMailMessage .= &quot;--{$strMessageSeperator}\n&quot;;
			$strMailMessage .= $this-&gt;getPreparedMailAttachment($this-&gt;arrAttachment[$i]['mime'], $strFileContents, $this-&gt;arrAttachment[$i]['name']);
		}

		$strMailMessage .= &quot;\n--{$strMessageSeperator}--\n&quot;;

		mb_internal_encoding($this-&gt;strEncoding);
		mail($this-&gt;strMailRecipient,
			mb_encode_mimeheader($this-&gt;strMailSubject, $this-&gt;strEncoding, 'B'),
			$strMailMessage,
			$strMailHeader);
	}

	/**
	 * Get prepared plaintext including mail content type part.
	 *
	 * @return string
	 */
	private function getPreparedMailPlainText() {
		$strResult = &quot;Content-Type: text/plain; charset=\&quot;{$this-&gt;strEncoding}\&quot;\n&quot;;
		$strResult .= &quot;Content-Transfer-Encoding: 7bit\n\n&quot;;
		$strResult .= &quot;{$this-&gt;strMailPlainText}\n&quot;;

		return $strResult;
	}

	/**
	 * Get prepared HTML code including mail content type part.
	 *
	 * @return string
	 */
	private function getPreparedMailHTML() {
		$strHTMLMessage = $this-&gt;getHTMLReplacedUmlauts();

		$strResult  = &quot;Content-Type: text/html; charset=\&quot;{$this-&gt;strEncoding}\&quot;\n&quot;;
		$strResult .= &quot;Content-Transfer-Encoding: 7bit\n\n&quot;;
		$strResult .= &quot;{$strHTMLMessage}\n&quot;;

		return $strResult;
	}

	/**
	 * Get prepared Attachment code including mail content type part.
	 *
	 * @param string $mime
	 * @param string $strFile
	 * @param string $strName
	 * @return string
	 */
	private function getPreparedMailAttachment($strMime, $strFile, $strName) {
		$strResult  = &quot;Content-Type: $strMime; name=\&quot;$strName\&quot;\n&quot;;
		$strResult .= &quot;Content-Transfer-Encoding: base64\n&quot;;
		$strResult .= &quot;Content-Disposition: attachment; filename=\&quot;$strName\&quot;\n\n&quot;;
		$strResult .= base64_encode($strFile).&quot;\n&quot;;

		return $strResult;
	}

	/**
	 * Get HTML message part with replaced umlauts to html code.
	 *
	 * @return string
	 */
	private function getHTMLReplacedUmlauts() {
		$arrUmlauts = array('/ä/', '/ü/', '/ö/', '/Ä/', '/Ü/', '/Ö/', '/ß/', '/„/', '/“/');
		$arrReplace = array('&amp;auml;', '&amp;uuml;', '&amp;ouml;', '&amp;Auml;', '&amp;Uuml;', '&amp;Ouml;', '&amp;szlig;', '&amp;bdquo;', '&amp;ldquo;');

		$strResult = preg_replace($arrUmlauts, $arrReplace, $this-&gt;strMailHTML);

		return $strResult;
	}

	/**
	 * Get dynamic mail separator.
	 *
	 * @return string
	 */
	private function getMailSeperator() {
		return 'PHP'.md5(uniqid(time()));
	}

	/**
	 * Get standard mail header.
	 *
	 * @return string
	 */
	private function getStdMailHeader() {
		$strPHPVersion = phpversion();

		$strResult = &quot;To: {$this-&gt;strMailRecipient}\n&quot;;
		$strResult .= &quot;From: {$this-&gt;strMailSender}\n&quot;;
		$strResult .= 'Return-Path: '.$this-&gt;getMailReplyTo().&quot;\n&quot;;
		$strResult .= 'Reply-To: '.$this-&gt;getMailReplyTo().&quot;\n&quot;;
		$strResult .= &quot;X-Mailer: PHP/{$strPHPVersion}\n&quot;;

		return $strResult;
	}
}

?&gt;
</pre>
<p>Usage of class Mail.</p>
<pre class="brush: php;">
...
$mail = new Mail();
$mail-&gt;setMailHTML($html);
$mail-&gt;setMailPlainText($plainText);
$mail-&gt;setMailSubject($subject);
$mail-&gt;setMailRecipient($recipient);
$mail-&gt;setMailSender('no-reply@mydomain.com');
$mail-&gt;setMailReplyTo('reply@mydomain.com');
</pre>


<p>Related posts:<ol><li><a href='http://www.codeterrorizer.com/php/function-subwords-gets-words-by-max-string-length' rel='bookmark' title='Permanent Link: Function subwords, gets words by max string length'>Function subwords, gets words by max string length</a></li><li><a href='http://www.codeterrorizer.com/php/twitter-curl-found-in-the-net-with-some-changes' rel='bookmark' title='Permanent Link: Twitter CURL (found in the net, with some changes)'>Twitter CURL (found in the net, with some changes)</a></li><li><a href='http://www.codeterrorizer.com/jquery/simple-example-on-how-to-search-a-list-with-jquery' rel='bookmark' title='Permanent Link: Simple example on how to search a list with jQuery'>Simple example on how to search a list with jQuery</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.codeterrorizer.com/php/php-class-mail/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS :hover Pseudo Class</title>
		<link>http://www.codeterrorizer.com/css-hacks/css-hover-pseudo-class</link>
		<comments>http://www.codeterrorizer.com/css-hacks/css-hover-pseudo-class#comments</comments>
		<pubDate>Tue, 29 Sep 2009 08:07:36 +0000</pubDate>
		<dc:creator>Markus Bäck</dc:creator>
				<category><![CDATA[Css Hacks]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[hover]]></category>
		<category><![CDATA[ie]]></category>
		<category><![CDATA[ie6]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.codeterrorizer.com/?p=158</guid>
		<description><![CDATA[
IE only supports :hover pseudo class for anchor elements. You can fix this issue with jQuery&#8217;s hover event.
jQuery

$('ul li').hover(

function () {
$(this).addClass('element');
},

function() {
$(this).removeClass('element');
}
);

CSS

.element {
background-color:red;
}

UL List

&#60;ul&#62;
   &#60;li&#62;&#60;a href=&#34;#&#34; title=&#34;Home&#34;&#62;Home&#60;/a&#62;&#60;/li&#62;
   &#60;li&#62;&#60;a href=&#34;#&#34; title=&#34;About&#34;&#62;About&#60;/a&#62;&#60;/li&#62;
   &#60;li&#62;&#60;a href=&#34;#&#34; title=&#34;Portfolio&#34;&#62;Portfolio&#60;/a&#62;&#60;/li&#62;
   &#60;li&#62;&#60;a href=&#34;#&#34; title=&#34;Contact&#34;&#62;Contact&#60;/a&#62;&#60;/li&#62;
&#60;/ul&#62;



Related posts:Simple example on how to search a list with jQueryCSS Hack Read More


Related posts:<ol><li><a href='http://www.codeterrorizer.com/jquery/simple-example-on-how-to-search-a-list-with-jquery' rel='bookmark' title='Permanent Link: Simple example on how to search a list with jQuery'>Simple example on how to search a list with jQuery</a></li><li><a href='http://www.codeterrorizer.com/css-hacks/css-hack-fur-internet-explorer-8-ie8' rel='bookmark' title='Permanent Link: CSS Hack for Internet Explorer 8 (IE8)'>CSS Hack for Internet Explorer 8 (IE8)</a></li><li><a href='http://www.codeterrorizer.com/css-hacks/italic-font-style-causes-oversized-divs-in-ie6' rel='bookmark' title='Permanent Link: italic font-style causes oversized divs in IE6'>italic font-style causes oversized divs in IE6</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p><span id="more-158"></span><br />
IE only supports :hover pseudo class for anchor elements. You can fix this issue with jQuery&#8217;s hover event.</p>
<h4>jQuery</h4>
<pre class="brush: jscript;">
$('ul li').hover(

function () {
$(this).addClass('element');
},

function() {
$(this).removeClass('element');
}
);
</pre>
<h4>CSS</h4>
<pre class="brush: css;">
.element {
background-color:red;
}
</pre>
<h4>UL List</h4>
<pre class="brush: xml;">
&lt;ul&gt;
   &lt;li&gt;&lt;a href=&quot;#&quot; title=&quot;Home&quot;&gt;Home&lt;/a&gt;&lt;/li&gt;
   &lt;li&gt;&lt;a href=&quot;#&quot; title=&quot;About&quot;&gt;About&lt;/a&gt;&lt;/li&gt;
   &lt;li&gt;&lt;a href=&quot;#&quot; title=&quot;Portfolio&quot;&gt;Portfolio&lt;/a&gt;&lt;/li&gt;
   &lt;li&gt;&lt;a href=&quot;#&quot; title=&quot;Contact&quot;&gt;Contact&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</pre>


<p>Related posts:<ol><li><a href='http://www.codeterrorizer.com/jquery/simple-example-on-how-to-search-a-list-with-jquery' rel='bookmark' title='Permanent Link: Simple example on how to search a list with jQuery'>Simple example on how to search a list with jQuery</a></li><li><a href='http://www.codeterrorizer.com/css-hacks/css-hack-fur-internet-explorer-8-ie8' rel='bookmark' title='Permanent Link: CSS Hack for Internet Explorer 8 (IE8)'>CSS Hack for Internet Explorer 8 (IE8)</a></li><li><a href='http://www.codeterrorizer.com/css-hacks/italic-font-style-causes-oversized-divs-in-ie6' rel='bookmark' title='Permanent Link: italic font-style causes oversized divs in IE6'>italic font-style causes oversized divs in IE6</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.codeterrorizer.com/css-hacks/css-hover-pseudo-class/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
