<?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>Nico.Berlee.nl &#187; PHP</title>
	<atom:link href="http://nico.berlee.nl/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://nico.berlee.nl</link>
	<description>a digital portfolio</description>
	<lastBuildDate>Sat, 21 Jan 2012 21:31:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>AjaxBerlee 1.3a WordPress Theme</title>
		<link>http://nico.berlee.nl/ajaxberlee-13-wordpress-theme/</link>
		<comments>http://nico.berlee.nl/ajaxberlee-13-wordpress-theme/#comments</comments>
		<pubDate>Sat, 19 May 2007 14:26:36 +0000</pubDate>
		<dc:creator>Nico</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[page-loading]]></category>
		<category><![CDATA[theme]]></category>

		<guid isPermaLink="false">http://nico.berlee.nl/ajaxberlee-13-wordpress-theme/</guid>
		<description><![CDATA[CHANGES FEATURE: Better visitor experience when clicking on a link/search or commenting. Especially when the server or the connection is slow. It is configurable in the WP Admin Panel. Thanks to Vijayendra Mohanty for suggesting it FEATURE: You can now disable the Left-Sidebar to have a bigger main column. Thanks to Becky Lai for the [...]]]></description>
			<content:encoded><![CDATA[<p><strong>CHANGES</strong></p>
<ul>
<li>FEATURE: Better visitor experience when clicking on a link/search or commenting. Especially when the server or the connection is slow. It is configurable in the WP Admin Panel. Thanks to Vijayendra Mohanty for suggesting it</li>
<li>FEATURE: You can now disable the Left-Sidebar to have a bigger main column. Thanks to Becky Lai for the idea that is showed on <a href="http://www.sockparade.com">www.sockparade.com</a></li>
</ul>
<p><span id="more-56"></span></p>
<ul>
<li>FEATURE: About text and link is configurable in WordPress Admin Panel
</li>
<li>ENHANCEMENT: The number of Recent Posts in the Slide Ticker is now configurable.
</li>
<li>ENHANCEMENT: The post tags are now also in the post itself.
</li>
<li>ENHANCEMENT: Code for the WP Ajax Connector Framework is now in it own files.. It also has its own Admin Panel page.
</li>
<li>ENHANCEMENT: The comment submit button is immediately disabled when your clicked on it, so double clicks because the visitor is inpatient can not occur.
</li>
<li>ENHANCEMENT: History (back and forward navigation) in Internet Explorer finally works! It was really a pain to get the workaround working right with a minimum amount of coding&#8230;</li>
<li>BUGFIX: An error message can be displayed if something went wrong with the comment submitting.<br />Merged the commenting code of WordPress 2.2 which should be backwards compatible.</li>
<li>BUGFIX: Double title in Categories when not using widgets. Thanks to Martin BÃ¶ttinger for reporting it. I failed to notice it <img src='http://nico.berlee.nl/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </li>
<li>BUGFIX: Image preloading didn&#8217;t really loaded all images on a very fast visitor pc.</li>
<li>BUGFIX: Anchors should now be working right (not getting a 404 page not found anymore)</li>
<li>VISUAL: Changed the bullet.gif so It won&#8217;t contain a dot inside&#8230; Didn&#8217;t really like it <img src='http://nico.berlee.nl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
</ul>
<p>Sorry, no notes on 1.3 to 1.3a I was too busy fixing bugs and lost track of all the changes committed <img src='http://nico.berlee.nl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Upgrade note:<br />
If you are updating from 1.2, please note that some files have been renamed! Also, if you enabled the Slide Ticker on your site, please go to the WP Admin Panel -&gt; Presentation -&gt; AjaxBerlee Options and change the value of the Slide Ticker to a number, for example 15.<br />
You also might want to change the about text since it is now controlled in the WP Admin Panel</p>
<p><a href='http://nico.berlee.nl/files/2007/06/ajaxberlee13a.zip' title='Download AjaxBerlee 1.3a'>Download AjaxBerlee 1.3a</a></p>
]]></content:encoded>
			<wfw:commentRss>http://nico.berlee.nl/ajaxberlee-13-wordpress-theme/feed/</wfw:commentRss>
		<slash:comments>166</slash:comments>
		</item>
		<item>
		<title>AjaxBerlee 1.2 WordPress Theme</title>
		<link>http://nico.berlee.nl/ajaxberlee-12-wordpress-theme/</link>
		<comments>http://nico.berlee.nl/ajaxberlee-12-wordpress-theme/#comments</comments>
		<pubDate>Tue, 08 May 2007 14:05:32 +0000</pubDate>
		<dc:creator>Nico</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[page-loading]]></category>
		<category><![CDATA[theme]]></category>

		<guid isPermaLink="false">http://nico.berlee.nl/ajaxberlee-12-wordpress-theme/</guid>
		<description><![CDATA[Please use the latest version! FEATURE: Configurable options in WordPress Admin Panel! SUPPORT: WordPress Widget support ENHANCEMENT: Made the TextSlider code much nicer. And works much better now. ENHANCEMENT: Replaced WordPress functions for the theme that where deprecated in WordPress 2.1 and no longer supported. This means there no WordPress 2.0 support anymore in this [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Please use the latest version!</strong><br />
<a href='http://nico.berlee.nl/files/2007/05/themeoptions.jpg' title='Click to view'><img src='http://nico.berlee.nl/files/2007/05/themeoptions.thumbnail.jpg' class='right' alt='Theme options' /></a></p>
<ul>
<li>FEATURE: Configurable options in WordPress Admin Panel!</li>
<li>SUPPORT: WordPress Widget support</li>
<li>ENHANCEMENT: Made the TextSlider code much nicer. And works much better now.</li>
</ul>
<p><span id="more-55"></span></p>
<ul>
<li>ENHANCEMENT: Replaced WordPress functions for the theme that where deprecated in WordPress 2.1 and no longer supported. This means there no WordPress 2.0 support anymore in this theme!</li>
<li>ENHANCEMENT: When one of the membership options under General Option (in WordPress Panel) is set an Login/Logout Register/Site Admin will appear on the left sidebar. (when not using widgets)</li>
<li>ENHANCEMENT: When a blog is accessible with more than one URL, it will all be redirected to the blog URL defined in WP-admin since the Ajax functions must obey the Same Origin Policy:  http://www.mozilla.org/projects/security/components/same-origin.html</li>
<li>BUGFIX: Fixed timing issue only occourred with Internet Explorer with a # link&#8230; Because it executed the javascript faster than the page could load&#8230; This would bring up an Navigation cancelled dialog box.</li>
<li>BUGFIX: Some characters in the title with accent or circumflexes or just a plane &#8216; quote would be displayed as HTML character entities. (for example &quot; &amp; &lt; &gt;)</li>
<li>BUGFIX: Images with a space in the URL are not preloaded.</li>
<li>BUGFIX: An URL to an external page containing your blog url as a parameter are treated like an internal page. Resulting in a 404 Page not found.</li>
</ul>
<p><strong>Installation</strong></p>
<p>It&#8217;s pretty straight forward, just put the whole directory AjaxBerlee (and content in it of course) to the wp-content/themes. After that, goto Presentation -&gt; Current Theme Options and select the options you like.</p>
<p><strong>Big Tip</strong><br />
Use WordPress Widgets! You can download it from <a href="http://automattic.com/code/widgets">http://automattic.com/code/widgets</a> after that copy the widgets from the plugins/widgets to the widgets directory on the webserver and active them.This allows you to use all components in the sidebar that currently statically exists, to use them very dynamically!</p>
]]></content:encoded>
			<wfw:commentRss>http://nico.berlee.nl/ajaxberlee-12-wordpress-theme/feed/</wfw:commentRss>
		<slash:comments>39</slash:comments>
		</item>
		<item>
		<title>AjaxBerlee 1.1 WordPress Theme</title>
		<link>http://nico.berlee.nl/ajaxberlee-11-wordpress-theme/</link>
		<comments>http://nico.berlee.nl/ajaxberlee-11-wordpress-theme/#comments</comments>
		<pubDate>Fri, 04 May 2007 15:00:19 +0000</pubDate>
		<dc:creator>Nico</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[page-loading]]></category>
		<category><![CDATA[theme]]></category>

		<guid isPermaLink="false">http://nico.berlee.nl/ajaxberlee-11-wordpress-theme/</guid>
		<description><![CDATA[Please use the latest version! A minimal, simple, crisp, clear and light 3 column design. This plugin independent theme highlights the excerpt of the latest article on the home page. AjaxBerlee is based on the Brajeshwar theme, but itâ€™s much faster and it comes with interesting AJAX features such as Instant Comment, Instant Search, Page [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Please use the latest version!</strong></p>
<p>A minimal, simple, crisp, clear and light 3 column design. This plugin independent theme highlights the excerpt of the latest article on the home page.<span id="more-47"></span></p>
<p>AjaxBerlee is based on the Brajeshwar theme, but itâ€™s much faster and it comes with interesting AJAX features such as Instant Comment, Instant Search, Page and Image preloading and an article slider.</p>
<p><strong>Changes</strong></p>
<ul>
<li>Loads of little code enhancements in the WP Ajax Connector Framework to make it more robust and better compatible with Firefox</li>
<li>Preloading of images when a visitor hover over an article link that contains images</li>
<li>Navigation on the front page (older articles)</li>
<li>Merged some of the code of Brajeshwar 7.2.2</li>
<li>Added support for some plug-ins&#8230; See TIPS in ReadMe.txt</li>
</ul>
<p><strong>Compatibility</strong><br />
AjaxBerlee Theme and the WP Ajax Connector Framework are compatible with WordPress:</p>
<ul>
<li>WordPress 2.0.x</li>
<li>WordPress 2.1.x (tested up to 2.1.3)</li>
<li>WordPress-MU (tested up to 1.2.1)</li>
</ul>
<p>Tested on browsers:</p>
<ul>
<li>Internet Explorer 6 &amp; 7</li>
<li>Firefox 2.0.0.3</li>
<li>Opera 9.20</li>
</ul>
<p><strong>Please the latest version!</strong></p>
<p><strong>Common Problem!</strong><br />
It&#8217;s very important that you fill in the right WordPress and Blog address in the WordPress Admin Panel under options:<br />
<img src='http://nico.berlee.nl/files/2007/05/url.gif' alt='URL options in WordPress Admin Panel' /></p>
<p>While this sounds a bit obvious, when your site is www.berlee.nl please double check this value in the Admin Panel to see if it really says http://www.berlee.nl and not http://berlee.nl because that results in a unbrowseable website</p>
<p>Because of security issues Ajax request works only from the url that is configured in the WordPress Admin Panel.</p>
]]></content:encoded>
			<wfw:commentRss>http://nico.berlee.nl/ajaxberlee-11-wordpress-theme/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>AdSense and AJAX: Not a happy combination</title>
		<link>http://nico.berlee.nl/adsense-and-ajax-not-a-happy-combination/</link>
		<comments>http://nico.berlee.nl/adsense-and-ajax-not-a-happy-combination/#comments</comments>
		<pubDate>Sun, 22 Oct 2006 20:05:38 +0000</pubDate>
		<dc:creator>Nico</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://nico.berlee.nl/adsense-and-ajax-not-a-happycombination/</guid>
		<description><![CDATA[After releasing my AjaxBerlee WordPress theme George and Milan&#8217;Che reported problems with Google&#8217;s AdSense. This left me with a problem. Because new page requests in my theme are parsed over the old ones. AdSense works as follows. The Mediapartners-Google spider indexes the site, when visitor now requests one of your pages it will load the [...]]]></description>
			<content:encoded><![CDATA[<p>After releasing my <a href="http://nico.berlee.nl/ajaxberlee-wordpress-theme-released/">AjaxBerlee</a> WordPress theme George and Milan&#8217;Che reported problems with Google&#8217;s <a href="https://www.google.com/adsense/">AdSense</a>. This left me with a problem. Because new page requests in my theme are parsed over the old ones.<span id="more-29"></span></p>
<p>AdSense works as follows. The Mediapartners-Google spider indexes the site, when visitor now requests one of your pages it will load the external JavaScript from the Google domain. In that JavaScript the text advertise is displayed.</p>
<p>So far so good. An AJAXified page will initially display the AdSense advertise very well (because the pages are <a href="http://nico.berlee.nl/my-improved-website-response-with-ajax/">backwards compatible</a>). The visitor clicks on a link and now only a part of the page get reloaded, but not the AdSense advertise. Because it&#8217;s possible to load an JavaScript into JavaScript, but its not possible to reload JavaScript into JavaScript (for scripts that aren&#8217;t build for it).</p>
<p>I suspected that Google had some kind of a refresh function build in where I could specify which URL the currently displayed AJAXified site was. So when you click on an AJAXified link, the Ajax JavaScript calls a Google refresh function. (this is actually how the <a href="http://www.google.com/analytics/">Google Analytics</a> support works in the AJAX JavaScript)</p>
<p>I was surprised to find out that there was not such a function in the AdSense JavaScript. So I tried to find out how AJAXified sites like <a href="http://maps.google.com">Google Maps</a> and <a href="http://www.gmail.com/">GMail</a> works with AdSense. Well, actually, they don&#8217;t!</p>
<p>GMail has some uses some AJAX function to display realtime new incoming messages, but the actually displaying of mail goes thru frames and plain old loading of pages! And Google Maps actually doesn&#8217;t use AdSense at all&#8230; Well, they do, but its parsed into the page and doesn&#8217;t use external JavaScript at all, as described above.</p>
<p>I found <a href="http://www.jguru.com/forums/view.jsp?EID=1305379">one workaround by Kevin Cho</a> who used an iframe. In that iframe the AdSense got loaded with the keywords of that page specially dedicated for AdSense for that site. You need to type these manually, which is a hell of a job if you have a lot of pages. And it&#8217;s probably against the <a href="https://www.google.com/adsense/support/bin/topic.py?topic=8423">Program Policies</a> which are very clear about cloaking.</p>
<p>I decided not to implement that workaround because of the Program Policies violation. But I will publish a modified ajax.js that is compatible with AdSense but does not have the enhanced page loading.</p>
]]></content:encoded>
			<wfw:commentRss>http://nico.berlee.nl/adsense-and-ajax-not-a-happy-combination/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>AjaxBerlee WordPress theme released</title>
		<link>http://nico.berlee.nl/ajaxberlee-wordpress-theme-released/</link>
		<comments>http://nico.berlee.nl/ajaxberlee-wordpress-theme-released/#comments</comments>
		<pubDate>Tue, 17 Oct 2006 00:24:42 +0000</pubDate>
		<dc:creator>Nico</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[theme]]></category>

		<guid isPermaLink="false">http://nico.berlee.nl/ajaxberlee-wordpress-themereleased/</guid>
		<description><![CDATA[Please use the latest version! With proud I present to you &#8230;.. my theme. I finally decided it&#8217;s works good enough to be used by others. My theme is based on brajeshwar with some small visual adjustments. The biggest changes are under the hood: Instant Search (Gives you results when you type!) Instant Comment (Page [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Please use the latest version!</strong></p>
<p>With proud I present to you &#8230;.. my theme. I finally decided it&#8217;s works good enough to be used by others.<span id="more-28"></span> My theme is based on <a href="http://www.brajeshwar.com">brajeshwar</a> with some small visual adjustments. The biggest changes are under the hood:</p>
<ul>
<li>Instant Search (Gives you results when you type!)</li>
<li>Instant Comment (Page does not reloaded when you submit your comment)</li>
<li>Advanced Ajax page loading see <a href="http://nico.berlee.nl/my-improved-website-response-with-ajax/">My improved website response with Ajax</a> and <a href="http://nico.berlee.nl/solved-latency-problems-with-ajax/">Solved latency problems with Ajax</a></li>
</ul>
<p>All driven by my own build <a href="http://nico.berlee.nl/ajax-javascript-libraries/">very light weighted framework</a> which I will release hopefully later this week separately with a howto to adapt it to your own WordPress theme.</p>
<p>I released the theme and framework under <a href="http://www.gnu.org/copyleft/gpl.html">GPL</a>.<br />
<strong>Please the latest version!</strong><br />
Please read the readme.txt before putting it on your site.<br />
AjaxBerlee depends on a modified pagesnav version of Adi Sieker which you can download <a href="http://nico.berlee.nl/wp-content/uploads/wp-pagesnav.zip">here</a></p>
<p><em><strong>Note: for everyone whole I going to change things in the theme: Please go to line 26 of ajax.php and put // before ClientCache();</strong></em></p>
<p><em>This will prevent the browser of displaying and old cached version of the theme (the content of WordPress is in any case up to date!)</em></p>
<p>TIP: Google Analytics support is build in. Take a look at footer.php:<br />
Remove on line 7 &lt;!&#8212; and &#8212;&gt;<br />
Remove on line 11 &amp; 13 /* and */<br />
And fill your UA number from Google analytics on line 12.</p>
]]></content:encoded>
			<wfw:commentRss>http://nico.berlee.nl/ajaxberlee-wordpress-theme-released/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
		<item>
		<title>Solved latency problems with Ajax</title>
		<link>http://nico.berlee.nl/solved-latency-problems-with-ajax/</link>
		<comments>http://nico.berlee.nl/solved-latency-problems-with-ajax/#comments</comments>
		<pubDate>Sat, 09 Sep 2006 15:06:47 +0000</pubDate>
		<dc:creator>Nico</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[cached]]></category>
		<category><![CDATA[Internet-Explorer]]></category>
		<category><![CDATA[latency]]></category>
		<category><![CDATA[RFC]]></category>

		<guid isPermaLink="false">http://nico.berlee.nl/solved-latency-problems-withajax/</guid>
		<description><![CDATA[Cache is your friend, not the enemy Internet Explorer handlesÂ AJAX responses different than other browsers. It will cache the response. The tendencyÂ on most articles I&#8217;ve read is: Caching is bad and you need disable caching!. No!!! Although Microsoft didn&#8217;t program Internet Explorer to respond according to RFC IE should do,Â that&#8217;s not an excuse to totally [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Cache is your friend, not the enemy</strong></p>
<p>Internet Explorer handlesÂ AJAX responses different than other browsers. It will cache the response. The tendencyÂ on most articles I&#8217;ve read is: Caching is bad and you need disable caching!. No!!! Although Microsoft didn&#8217;t program Internet Explorer to respond according to RFC IE should do,Â that&#8217;s not an excuse to totally disable Cache. When visitors click on a link they expect something happens. Although AJAX makes the response time shrink, you don&#8217;t have any guarantee about the noveltyÂ of the content.<span id="more-27"></span></p>
<p><strong>Sending the right headers</strong></p>
<p>No, I am not talking about soccer. WordPress sends headers to prevent caching. I changed that because caching is not that bad. It&#8217;s all about sending the right headers and extending the intelligence in WordPress. The WordPress database keeps track of all date and times when the content changed. This is great, because now you can incorporate that date and time into the header. The second time the user asks for the content, the client send a If-modified-since in the request header with the date and time of the first response of the same content. If the content isn&#8217;t changed since, the response will be a HTTP 304 Not Modified (nothing more), the client will than get it out of the memory or the temporary Internet files.</p>
<p>Typically this saves a lot of bandwidth and latency.</p>
<p><strong>Prefetching</strong></p>
<p>The JavaScript on the client side tries to guess if you go to click on a link or not, just by measuring the time your mouse cursor is on the link, if it&#8217;s more than 0.2 seconds, itÂ evaluates that chances are that you are eventually clicking on the linkÂ are big. So JavaScript starts fetching the page into memory.</p>
<p>In combination with the paragraph above, this gives a great performance boost. If the user doesn&#8217;t click on the link for now, it doesn&#8217;t matter because the next time the user might click on it, and on that point the JavaScript only have to collect a HTTP 304 Not Modified header (which is lesser than 300 bytes).</p>
]]></content:encoded>
			<wfw:commentRss>http://nico.berlee.nl/solved-latency-problems-with-ajax/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>My improved website response with Ajax</title>
		<link>http://nico.berlee.nl/my-improved-website-response-withajax/</link>
		<comments>http://nico.berlee.nl/my-improved-website-response-withajax/#comments</comments>
		<pubDate>Sat, 19 Aug 2006 20:06:26 +0000</pubDate>
		<dc:creator>Nico</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Internet-Explorer]]></category>
		<category><![CDATA[Opera]]></category>
		<category><![CDATA[page-loading]]></category>

		<guid isPermaLink="false">http://nico.berlee.nl/my-improved-website-response-withajax/</guid>
		<description><![CDATA[I am an ajax-fan, in fact I watch every soccer match on TV. Ok, but that&#8217;s probably not what you want you are interested in . I really start wondering how to improve the response time after IÂ concluded that it would be allot of workÂ to convert this theme to a lightpress theme (I had to [...]]]></description>
			<content:encoded><![CDATA[<p>I am an ajax-fan, in fact I watch every soccer match on TV. Ok, but that&#8217;s probably not what you want you are interested in <img src='http://nico.berlee.nl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>I really start wondering how to improve the response time after IÂ concluded that it would be allot of workÂ to convert this theme to a <a href="http://www.lightpress.org">lightpress</a> theme (I had to make a lot of plugins to get it to work).<span id="more-25"></span></p>
<p>So I started to think about other possibilities. The nice thing about lightpress was, it would only query the data in the database that was actually needed. So I tried to make an intelligentÂ PHP frontend that only parses parts of the page that needs to change when youÂ switch from page to pageÂ and gives it, wrapped in XML (because more than one part of the site need to change) to the JavaScript on the Client. The JavaScript on the client thenÂ parses the XML responseÂ andÂ renders itÂ in the DIVs on the website.</p>
<p>Needles to say, itÂ saves a lot of bandwidth. My average page sizeÂ did goÂ from 15kb to 5kb (uncompressed, with ZLib compression, often not more than 1kb!). This has a lot of advantages, becauseÂ it uses less processing andÂ parsing time on the server and less download and render time on the client, and it looks nicer towards the user because the page doesn&#8217;t get refreshed.Â IÂ The only overhead is the 4kb JavaScript, which is nothing compared to someÂ <a href="http://nico.berlee.nl/ajax-javascript-libraries/">other ajax JavaScript libraries.</a></p>
<p><strong>Backwards compatible</strong></p>
<p>Backwards compatibility was a key requirement for me. Since Google, MSN search, yahoo and other search spider bots don&#8217;t understand the the first thing about JavaScript or cookies. And, of course, the security nutheads (people that read security bulletins andÂ don&#8217;t mitigate)Â that disables JavaScript because they think they are safer off. Ok I am going off topic, but think of it for a second. You are much, much, much better off (security and compatibility wise) by running Firefox of Opera as aÂ limited user (right-click on the shortcut, run as),Â instead of disabling JavaScript in Internet Explorer!</p>
<p>JavaScript is responsible for turning the normal A HREF links to an ajax request in the background. This way it&#8217;s fully backwards compatible&#8230; Even if JavaScript works and even if the ajax request fails, It will switch to the old A HREF link.</p>
]]></content:encoded>
			<wfw:commentRss>http://nico.berlee.nl/my-improved-website-response-withajax/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Instant Search in WordPress</title>
		<link>http://nico.berlee.nl/instant-search-in-wordpress/</link>
		<comments>http://nico.berlee.nl/instant-search-in-wordpress/#comments</comments>
		<pubDate>Tue, 25 Jul 2006 18:33:16 +0000</pubDate>
		<dc:creator>Nico</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[instant]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[search]]></category>

		<guid isPermaLink="false">http://nico.berlee.nl/instant-search-inwordpress/</guid>
		<description><![CDATA[When I updated to version 2.0.3 of wordpress, I came across a some ajax plugins. Live search 1.2 seemed great, but the version just did not work as described&#8230;. bummer&#8230; so I came across Ajaxsearch 0.1 and surprise, surprise, it actually worked. The idea behind Ajaxsearch, intentionally or not, is very smart. When you start [...]]]></description>
			<content:encoded><![CDATA[<p>When I updated to version 2.0.3 of wordpress, I came across a some ajax plugins. Live search 1.2 seemed great, but the version just did not work as described&#8230;. bummer&#8230; so I came across <a href="http://www.start.com.my/blog/ajaxsearch/">Ajaxsearch 0.1</a> and surprise, surprise, it actually worked. The idea behind Ajaxsearch, intentionally or not, is very smart.<span id="more-53"></span></p>
<p>When you start typing stuff into the searchbox, in the background the server is going to execute the php script that search every tie you type a letter. So in order to get results fast, you need a very sleek script that is doing just only that as optimal as possible.</p>
<p>Ajaxsearch works independently from wordpress includes and functions (which are great if you just load the page once <img src='http://nico.berlee.nl/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  ). So I started to integrate the instant search into my brajeshwar theme. As I wanted to see the text in the message aswell, and dropdown box below the search field was simply not an option. I didn&#8217;t want an autocomplete function, I wanted an instant search function! So now it pushes articles away if it needs space for the search results. Which is actually not so difficult at all if you know a bit of CSS markup&#8230;. because the ajaxsearch javascript uses innerhtml to drop the results in an div. which is practical because now I could drop</p>
<pre>&lt;div id="instantsearch"&gt;&lt;/div&gt;</pre>
<p>where-ever I want.</p>
<p>Then i dropped this in the CSS:</p>
<pre>#instantsearch div {
border-top: 1px solid #e5e5e5;
border-bottom: 1px solid #e5e5e5;
background: #FFFFEE;
}
#instantsearch ul li {
background: none;
line-height: 15px;
padding: 0 15px;
font-size: 0.85em;
}
#instantsearch ul{
margin: 0;
}
#instantsearch h3 {
padding: 0px 15px;
margin-top: 0px;
text-transform: uppercase;
letter-spacing: 0.2em;
}
#instantsearch h3 {
padding: 20px 15px 10px;
text-transform: uppercase;
letter-spacing: 0.2em;
}
#col-right input {
width: 185px;
}</pre>
<p>Then I dropped the following html code inside a text widget, but if you don&#8217;t have the widget you can also put it inside the left or right sidebar</p>
<pre>&lt;script type="text/javascript" src="/ajaxsearch.js" mce_src="/ajaxsearch.js"&gt;&lt;/script&gt;&lt;form action="javascript:return false;" onsubmit="return false;"&gt;&lt;div&gt;&lt;input type="text" name="searchnicoberleenl1" value="Type to search instantly..."
onfocus="this.value = '';" onblur="this.value = 'Type to search instantly...';"
onkeyup="SendQuery(this.value)"/&gt;&lt;/div&gt;&lt;/form&gt;&lt;br /&gt;</pre>
<p>Please make sure you change the <em>searchnicoberleenl1</em> to something else. I had to use a name that is unique, I can&#8217;t set autocomplete=&#8221;off&#8221; because it&#8217;s not valid xhtml 1.0.</p>
<p>You can download the modified ajaxsearch.php and ajaxsearch.js from <a href="http://nico.berlee.nl/wp-content/uploads/modifiedajaxsearch.zip">here</a>. Put them in the root of your site.</p>
<p>So I start with ajaxsearch.js. I didn&#8217;t change much. The code does a good job, I only cleaned it up (tabs instead of spaces, for file download purpose) and removed the unnecessarily UnHideDiv() and HideDiv()</p>
<p>As you can see I changed a lot of things in ajaxsearch.php. First of all, the original version contains serious flaws:</p>
<ul>
<li>It does not take the post status in account, this means, that drafts and private posts are just as searchable as published posts</li>
<li>html code in the post will be also on the search result, which could rune your complete blog layout</li>
<li>The like query was not very sql server friendly when you have a big blog.</li>
</ul>
<p>The MySQL (like some other SQL servers) has a Full-Text-Search feature, which is a really great database search feature which almost gives you a functionality google inside your database. In a big blog you need such a feature because every keystroke must turn up a search result very fast.</p>
<p>The modified ajaxsearch.php uses the Full-Text-search feature and if this feature turns up with 0 results, it&#8217;s going to fallback on the old LIKE query. That&#8217;s because Full-Text-Search has a downside. In the MySQL implimentation it does not work on some known english stopwords and it&#8217;s start searching when 4 characters are given is set as default setting. In Boolean mode the sql server can give some results below 4 characters, but it&#8217;s not perfect.</p>
<p>Furthermore, you need to execute on sql query to enable the Full-Text-Search on that fields:</p>
<pre>CREATE FULLTEXT INDEX full_index ON `wp_posts`(
`post_title`,
`post_content`);</pre>
<p>In a 404 template you could use something like this:</p>
<pre>&lt;script type="text/javascript"&gt;
&lt;!--
SendQuery('&lt;?php echo trim(str_replace('/', ' ', str_replace('-', ' ', $_SERVER['REQUEST_URI']))); ?&gt;');
//--&gt;
&lt;/script&gt;</pre>
<p>Be sure to put this after the sidebar where the javascript file ajaxsearch.js is loaded <img src='http://nico.berlee.nl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I have no intension in releasing a real plugin. If you want to pack this in a real plugin, be my guest&#8230; (if you have permission of blewtooth)&#8230; anyway&#8230; If you in want to use something in this article, please do so&#8230; but it would be nice if you thank me in a comment in the code&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://nico.berlee.nl/instant-search-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

