<?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>Dwight Jack Diary &#187; Coding</title>
	<atom:link href="http://www.dwightjack.com/diary/category/coding/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dwightjack.com/diary</link>
	<description>Diary of music, design and code</description>
	<lastBuildDate>Tue, 13 Jul 2010 20:46:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Taming Flash Of Unstyled Content without blocking JavaScript loading</title>
		<link>http://www.dwightjack.com/diary/2010/06/10/taming-flash-of-unstyled-content-without-blocking-javascript-loading/</link>
		<comments>http://www.dwightjack.com/diary/2010/06/10/taming-flash-of-unstyled-content-without-blocking-javascript-loading/#comments</comments>
		<pubDate>Thu, 10 Jun 2010 16:23:19 +0000</pubDate>
		<dc:creator>Dwight Jack</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jajasvcript]]></category>
		<category><![CDATA[labjs]]></category>

		<guid isPermaLink="false">http://www.dwightjack.com/diary/?p=293</guid>
		<description><![CDATA[A smart way to overcome FOUC while still using LABjs as JavaScript non-blocking loading techniques.]]></description>
			<content:encoded><![CDATA[<p>One of the best rule in development is <strong>that the less you (as developper) struggle, the more the user will</strong>&#8230; and viceversa.</p>
<p>Lately i&#8217;ve tested some techniques to overcome the blocking nature of <code>script</code> tags to improve page load performance, and i ended up using <a href="http://labjs.com/" target="_blank"><strong>LABjs</strong></a> which seems a really promising project.<br />
 The main drawback of this non blocking  technique is that, since JavaScript parsing is not blocking the interface anymore users may encounter several flash of unstyled (or un-behaviored) content (<strong>FOUC &#8211; FUBC</strong>), which may break the interface (and make your marketing team screams at you).</p>
<p>The solution here is: <strong>struggle a bit more</strong> instead of leaving <code>script</code> tags in the <code>head</code>.</p>
<p>What i&#8217;ve came up by following some suggestions by the LABjs author and the web community is to separate my CSS styles in two separate levels: <strong>one for un-behaviored contents and one for JavaScript enabled browsers</strong>. <br />
 The trick is simple: since the only tag script you need is the one of LABjs, just open it and add this line at the very top of the file:</p>
<pre class="javascript"><code>
document.documentElement.className = 'hasJS';
</code>
</pre>
<p>This way you will add a <code>hasJS</code> class to the <code>html</code> tag that you may target in the CSS rules to overwrite and implement styles to get your interface ready for JavaScript interactions.</p>
<p>The drawback of this technique is that <strong>adding a class attibute to html tag won&#8217;t validate</strong>, but that&#8217;s the only CSS addressable node before DOM ready event.</p>
<p>This way your interface won&#8217;t flash anymore and your users won&#8217;t notice any change while JavaScript is getting loaded in a more efficient way.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dwightjack.com/diary/2010/06/10/taming-flash-of-unstyled-content-without-blocking-javascript-loading/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fix role attribute in Wordpress Search Widget</title>
		<link>http://www.dwightjack.com/diary/2010/03/12/fix-role-attribute-in-wordpress-search-widget/</link>
		<comments>http://www.dwightjack.com/diary/2010/03/12/fix-role-attribute-in-wordpress-search-widget/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 10:20:47 +0000</pubDate>
		<dc:creator>Dwight Jack</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[widgets]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.dwightjack.com/diary/?p=264</guid>
		<description><![CDATA[A quick and clean fix to make wordpress' default search widget valid by removing the role attribute in form tag.]]></description>
			<content:encoded><![CDATA[<p>While validating a Wordpress theme, I&#8217;ve  noticed that the default search widget outputted a <strong><code>role</code></strong> HTML attribute in the form tag that wasn&#8217;t valid in the XHTML 1.0 specification:</p>
<pre><code>&lt;form role="search" method="get" id="searchform" action=""&gt;
[...]
&lt;/form&gt;</code>
</pre>
<p>As for the spec, <code>role</code> is an attribute introduced in XHTML draft for accessibility, <strong>but still not valid</strong>.</p>
<p>If you need valid documents, the fastest way to get rid of this attribute is to edit the <code>get_search_form()</code> function in <code>general-template.php</code> core file, but<strong> for better compatibility and safer future upgrades </strong>you can target the issue from your theme&#8217;s <code>functions.php</code> file by adding the following lines:</p>
<pre><code>function valid_search_form ($form) {
    return str_replace('role="search" ', '', $form);
}
add_filter('get_search_form', 'valid_search_form');</code></pre>
<p><br class="spacer_" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dwightjack.com/diary/2010/03/12/fix-role-attribute-in-wordpress-search-widget/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>On the Bookshelf: MooTools 1.2 Beginner&#8217;s Guide</title>
		<link>http://www.dwightjack.com/diary/2010/02/10/mootools-12-beginners-guide/</link>
		<comments>http://www.dwightjack.com/diary/2010/02/10/mootools-12-beginners-guide/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 20:12:13 +0000</pubDate>
		<dc:creator>Dwight Jack</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[beginners guide]]></category>
		<category><![CDATA[Mootools]]></category>

		<guid isPermaLink="false">http://www.dwightjack.com/diary/?p=250</guid>
		<description><![CDATA[In nowadays frontend development JavaScript spans from rich interactions to animations, however we cannot rely on the native language's methods to implement everything we need in a smart and time-effective way.]]></description>
			<content:encoded><![CDATA[<p>In nowadays frontend development JavaScript spans from rich interactions to animations, however we cannot rely on the native language&#8217;s methods to implement everything we need in a smart and time-effective way.</p>
<p><a href="http://www.packtpub.com/mootools-1-2-beginners-guide/book?utm_source=dwightjack.com&amp;utm_medium=link&amp;utm_content=blog&amp;utm_campaign=mdb_002378"><img class="size-medium wp-image-252   alignright" style="float: right; margin-left: 10px;" title="MooTools" src="http://www.dwightjack.com/diary/wp-content/uploads/2010/02/MOOTOOLS1-243x300.jpg" alt="" width="146" height="180" /></a>The best solution for our coding needs is to adopt a JS framework as backbone for our scripts. One of the very first framework I&#8217;ve worked with is <strong><a title="Mootools" href="http://mootools.net/" target="_blank">Mootools</a></strong>, since it&#8217;s very developer friendly and fulfils lots of JavaScript&#8217;s &#8220;holes&#8221;.</p>
<p>In the next few days i&#8217;m going to receive a copy of:  <a href="http://www.packtpub.com/mootools-1-2-beginners-guide/book?utm_source=dwightjack.com&amp;utm_medium=link&amp;utm_content=blog&amp;utm_campaign=mdb_002378" target="_blank"><strong>MooTools 1.2 Beginner&#8217;s Guide</strong></a>, which I&#8217;m going to review for the sake of some of my followers and friends which are in need of a good starting point to learn how to improve their interfaces.</p>
<p>If you are interested you can check the details of the guide at the <a href="http://www.packtpub.com/mootools-1-2-beginners-guide/book?utm_source=dwightjack.com&amp;utm_medium=link&amp;utm_content=blog&amp;utm_campaign=mdb_002378" target="_blank">publisher website</a>.</p>
<p>Stay tuned!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dwightjack.com/diary/2010/02/10/mootools-12-beginners-guide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using multiple templates&#8217; overrides in Joomla 1.5 modules</title>
		<link>http://www.dwightjack.com/diary/2009/09/20/multiple-templates-overrides-joomla-modules/</link>
		<comments>http://www.dwightjack.com/diary/2009/09/20/multiple-templates-overrides-joomla-modules/#comments</comments>
		<pubDate>Sun, 20 Sep 2009 18:00:48 +0000</pubDate>
		<dc:creator>Dwight Jack</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[joomla]]></category>
		<category><![CDATA[Joomla 1.5]]></category>
		<category><![CDATA[modules]]></category>
		<category><![CDATA[template override]]></category>

		<guid isPermaLink="false">http://www.dwightjack.com/diary/?p=227</guid>
		<description><![CDATA[Step by step tutorial on adding a custom joomla module parameter type to apply different template's overrides on a module in a per-instance style with minumum hacks.]]></description>
			<content:encoded><![CDATA[<p>One of most usefull feature in Joomla 1.5 is the ability to quickly customize the HTML output of a module by using <strong>template overrides</strong> (see <a href="http://docs.joomla.org/How_to_override_the_output_from_the_Joomla!_core" target="_blank">here</a> for details).</p>
<p>The only problem is that, once you have coded an override for a module, it&#8217;ll be used for all module&#8217;s instances within the CMS. The issue here is that you might want to output one module in a column as just a simple list of links AND in the main body as a content-rich table.</p>
<p>This problem can be addressed <strong>with a module hack and the addition of a new backend parameter type</strong> (for 1.5 native modules only), both in a system wide or module specific way . Here is a step by step tutorial:</p>
<h3>Adding a new parameter to the module</h3>
<p>Joomla 1.5 features a native way to add backend parameter types beside the <a href="http://docs.joomla.org/Standard_parameter_types" target="_blank">native ones</a>. In our case i&#8217;ve realized a new element (parameter) file which will look if a template override folder exists for the spefic module and, if found, will list all PHP files whose name is prefixed with &#8220;<code>custom_</code>&#8221; . You can download the file <a href=http://www.dwightjack.com/diary/wp-content/plugins/download-monitor/download.php?id=14>here</a>.</p>
<p>Now you&#8217;ll need to place this file inside a folder called element, then open the .xml configuration file of the module and search for the <code>&lt;params&gt;</code> opening tag. Replace it with the following code (<code>YOURMODULENAME</code> is the module name):</p>
<pre><code>&lt;params addpath="/modules/mod_YOURMODULENAME/element"&gt;</code></pre>
<p>Now place the new parameter as the last child of the <code>&lt;params&gt;</code> tag:</p>
<pre><code>&lt;param name="template" type="customtemplates" modulename="mod_YOURMODULENAME" default="default" label="Custom template" description="Use this custom template file" /&gt;</code></pre>
<h3>Hacking the main PHP module file</h3>
<p>To make the module fully aware of the new template you choose, you need to pass the customtemplates paramenter to the static method which retrieves the template. For instance let&#8217;s say your <code>mod_mymodule.php</code> file has a line like this:</p>
<pre><code>require( JModuleHelper::getLayoutPath( 'mod_mymodule') );</code></pre>
<p>Now provide the <code>customtemplates</code> parameter by changing the line to:</p>
<pre><code>require( JModuleHelper::getLayoutPath( 'mod_mymodule',<span style="color: #ff0000;">$params-&gt;get('template','default')</span> ) );</code></pre>
<h3>Done!</h3>
<p>Untill no custom template&#8217;s overrides are found, the default template (default for the module or the default override if present) will be used. Once you&#8217;ll create a <code>custom_whatever.php</code> template file it&#8217;ll show up in the select list.</p>
<h3>Adding the new parameter system-wide</h3>
<p>By adding the parameter as a native-like parameter, you&#8217;ll be able to use it on all module without calling it in the &lt;params&gt; tag.</p>
<p>To add the paramenter system-wide you just have to place the <code>customtemplates.php</code> element in the /libraries/joomla/html/parameter/element folder. Since this is a custom element you shouldn&#8217;t have any problem on CMS upgrades.</p>
<h3>The drawback</h3>
<p>There&#8217;s a major drawback for this solution: since you are going to modify some module&#8217;s file you&#8217;ll need to keep a copy of them to prevent future upgrades from removing your changes (and breaking your template).</p>
<h3>Further readings</h3>
<p>Joomla has a really flexible parameter system, underused by many developers. Here are a couple of further reading to understand how parameters can help your everyday Joomla coding:</p>
<ul>
<li><a href="http://docs.joomla.org/Component_parameters#Types_of_Component_parameter" target="_blank">Joomla Docs: Component parameters</a></li>
<li><a href="http://www.teachmejoomla.net/code/joomla-1.5/joomla-php-developer-extending-config.xml-with-plugins.html" target="_blank">Joomla PHP: extending config.xml with plugins</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.dwightjack.com/diary/2009/09/20/multiple-templates-overrides-joomla-modules/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CRUDités: PHP5 class for MySQL database</title>
		<link>http://www.dwightjack.com/diary/2009/07/07/crudites-php5-class-for-mysql-database/</link>
		<comments>http://www.dwightjack.com/diary/2009/07/07/crudites-php5-class-for-mysql-database/#comments</comments>
		<pubDate>Tue, 07 Jul 2009 07:00:05 +0000</pubDate>
		<dc:creator>Dwight Jack</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[CRUDités]]></category>
		<category><![CDATA[ezSQL]]></category>
		<category><![CDATA[MySQL class]]></category>
		<category><![CDATA[PHP database class]]></category>

		<guid isPermaLink="false">http://www.dwightjack.com/diary/?p=203</guid>
		<description><![CDATA[CRUDités is a set of handy methods to quickly manage many operations of writing, storing and deleting from and to MySQL databases]]></description>
			<content:encoded><![CDATA[<p>Even if nowadays many web developers prefer to use Frameworks such as Zend, CakePHP or CodeIgniter, we often have small coding tasks to do, that aren&#8217;t worth the cost of deploying a whole application structure.</p>
<h3>ezSQL</h3>
<p>When dealing with MySQL databases, one of the most used PHP class is <a href="http://www.woyano.com/jv/ezsql" target="_blank"><strong>ezSQL</strong></a>, by Justin Vincent. If you&#8217;ve never listen about it, just think that a slightly modified version of this class is used as the core of <strong>Wordpress database library</strong>, and every time you query the database for a post, ezSQL comes in action.</p>
<p>Despite its effectiveness, ezSQL development seems to have stopped to version 2.04.</p>
<p>Since in my projects i often use this class to work with MySQL databases,<strong> i&#8217;ve written a small extension to the ezSQL_MySQL adapter</strong> to add shortcuts and more efficient functionalities to make further easier to manage databases&#8217; data with PHP. Here you are <strong>CRUDités</strong>.</p>
<h3>CRUDités: MySQL appetizer</h3>
<p><a title="CRUDités Homepage" href="http://www.dwightjack.com/projects/crudites/" target="_blank"><img class="alignright size-full wp-image-206" style="float:right;margin-left:10px" src="http://www.dwightjack.com/diary/wp-content/uploads/2009/07/logo.png" alt="CRUDités Logo" width="240" height="81" /></a></p>
<p><em>Crudités</em> are traditional French appetizers comprising sliced or whole raw vegetables. As of its name, CRUDités is just a set of <strong>handy methods</strong> to quickly manage many operations of writing, storing and deleting from and to MySQL databases.</p>
<p>Aside from the basic ezSQL methods, it adds some methods to <strong>build MySQL queries from strings and data arrays</strong>, new methods to retrieve datas from columns and rows, some utility methods and a whole <strong>new table binding system</strong>, to store table&#8217;s fields and quickly update and store new datas.<br />
For example you&#8217;ll be able to query a database and get a resulting array of rows just with this code:</p>
<pre><code>$rows = $db-&gt;get_data(array(
      'select' =&gt; 'id,name,surname',
      'from' =&gt; 'customer_names'
));
</code></pre>
<p>You can get more informations about the project by visiting its <strong><a href="http://www.dwightjack.com/projects/crudites/" target="_blank">main page</a></strong>, or you can directly download the class file by clicking here: <a href=http://www.dwightjack.com/diary/wp-content/plugins/download-monitor/download.php?id=12>CRUDités (13.5 kB)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dwightjack.com/diary/2009/07/07/crudites-php5-class-for-mysql-database/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Introducing Bicycle 1.2: a lightweight JavaScript library</title>
		<link>http://www.dwightjack.com/diary/2009/06/15/bicycle-12-a-lightweight-javascript-library/</link>
		<comments>http://www.dwightjack.com/diary/2009/06/15/bicycle-12-a-lightweight-javascript-library/#comments</comments>
		<pubDate>Mon, 15 Jun 2009 20:53:05 +0000</pubDate>
		<dc:creator>Dwight Jack</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[ajax framework]]></category>
		<category><![CDATA[javascript framework]]></category>
		<category><![CDATA[javascript library]]></category>
		<category><![CDATA[javascript shortcuts]]></category>

		<guid isPermaLink="false">http://www.dwightjack.com/diary/?p=175</guid>
		<description><![CDATA[Bicycle is a lightweight and efficient small library for JavaScript development featuring basic shortcuts and a full wrapper for events, AJAX and form handling]]></description>
			<content:encoded><![CDATA[<p>When i first stepped into JavaScript i found that one of web developers&#8217; common practice  was collecting  snippets of code (in form of prototypes, functions and shortcuts) to overcome both known JavaScript missing features and language&#8217;s verboseness.</p>
<p>Day by day, i&#8217;ve understood why so many developers use libraries (or frameworks) such as <strong>Mootools</strong> or <strong>jQuery:</strong> It&#8217;s a <em>matter of typing</em>.</p>
<pre><code>document.getElementById("test"); //native Javascript
$("#test"); // with jQuery</code></pre>
<p>At the same time i&#8217;ve learnt that <strong>libraries aren&#8217;t always worth their weight</strong>. Small projects don&#8217;t need them, and just writing a shortcut like:</p>
<pre><code>function id(string) {
   return document.getElementById(string);
}</code></pre>
<p>can make your life better (and more lightweight).</p>
<h3>Introducing Bicycle 1.2</h3>
<p><img class="size-full wp-image-184" align="right" style="margin-left:15px;" title="Bicycle 1.2" src="http://www.dwightjack.com/diary/wp-content/uploads/2009/06/bicyclelogo.png" alt="Bicycle 1.2" width="200" height="108" />That said, here is a new version of <strong>Bicycle</strong>, my little &#8220;JavaScript Collection&#8221;. As from the name, it&#8217;s a lightweight and load-cost-effective library (about <strong>9Kb minified</strong>) with everything is needed to <strong>keep your code simple and cross-browser</strong>. Here is a sample code:</p>
<pre><code>var el = $getEls("test");  // get the element with id "test"
var input = $TN("nametext");  // get the first element with name "nametext"</code></pre>
<h3>Chainability</h3>
<p>Anyway, if you need something more, since this new version Bicycle features a convenient <strong>chainability wrapper</strong>, with even new methods such as <strong>mouse and DOM-ready events</strong> and <strong>AJAX handling</strong>.</p>
<p>The chainable structure is bound to the <code>$b</code> namespace, so that you can use it along with other libraries. Here is a sample code:</p>
<pre><code>$b("#test").css("color","red").txt("New text!");</code></pre>
<p>See the <strong><a href="http://www.dwightjack.com/projects/bicycle/symbols/chain_chain-addons.html" target="_blank">documentation</a></strong> for more methods.</p>
<h3>Form Handling</h3>
<p>Finally, as a bonus, i&#8217;ve added a smart piece of code called <strong>Telegraph</strong>, which is basically a<strong> form handling library</strong> to quickly get and manipulate form inputs:</p>
<pre><code>$b.getForm("myForm").value("testinput"); // get an input value
$b.getForm("myForm").serialize(); // serialize form data in a JavaScript object</code></pre>
<h3>Grab a copy</h3>
<p>At last, <em>more code</em> can&#8217;t mean <em>same weight</em>, but i suppose you won&#8217;t mind it, &#8217;cause  Bicycle core + chainability + new methods + Telegraph is just <strong>22Kb minified</strong>.</p>
<p>Head to the main <a title="Bicycle JavaScript library" href="http://www.dwightjack.com/projects/bicycle/about.html" target="_blank"><strong>project page</strong></a> to get more infos and <a href="http://www.dwightjack.com/projects/bicycle/index.html" target="_blank">documentation</a>, or <strong><a title="Download Bicycle 1.2" href="http://www.dwightjack.com/diary/wp-content/plugins/download-monitor/download.php?id=11" target="_blank">grab a copy</a></strong> of the source code and &#8220;<em>take a ride</em>&#8221; with your brand new Bicycle.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dwightjack.com/diary/2009/06/15/bicycle-12-a-lightweight-javascript-library/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Update: Use MooTools v1.2.x in Joomla! 1.5</title>
		<link>http://www.dwightjack.com/diary/2009/06/07/use-mootools-122-in-joomla-15/</link>
		<comments>http://www.dwightjack.com/diary/2009/06/07/use-mootools-122-in-joomla-15/#comments</comments>
		<pubDate>Sun, 07 Jun 2009 14:39:40 +0000</pubDate>
		<dc:creator>Dwight Jack</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[joomla]]></category>
		<category><![CDATA[Joomla 1.5]]></category>
		<category><![CDATA[Mootools]]></category>

		<guid isPermaLink="false">http://www.dwightjack.com/diary/?p=167</guid>
		<description><![CDATA[This is an updated version of the code to switch Mootools from 1.11 to 1.2 in Joomla 1.5]]></description>
			<content:encoded><![CDATA[<p>Since i&#8217;ve fixed some bugs and issues on the files to switch core MooTools v1.11 to v1.2.x and following the release of version <span style="text-decoration: line-through;">1.2.2</span> 1.2.3 of <strong>MooTools Core and More</strong>, i&#8217;m posting here an updated version of<a title="Upgrade Mootools to v1.2.x in Joomla! 1.5" href="http://www.dwightjack.com/diary/2009/02/23/upgrade-mootools-to-v12x-in-joomla-15/"> <strong>this workaround</strong></a> to which you could refer for details on how this code works.</p>
<p>Changes in this new version are:</p>
<ol>
<li>Updated MooTools Core to<span style="text-decoration: line-through;"> <strong>1.2.2</strong></span><strong> 1.2.3</strong> and MooTools More to<span style="text-decoration: line-through;"> </span><strong><span style="text-decoration: line-through;">1.2.2.2</span> 1.2.3.1<br />
 </strong></li>
<li>Added <code>.getValue()</code> to the compatibility file</li>
<li>Added <code>.getSelected()</code> to the compatibility file to fix some issues under IE</li>
<li>Added <code>Json</code> support to the compatibility file</li>
<li>Added <code>window.onDomReady</code> shortcut for DOM ready event</li>
<li>Changed <code class="php">MY_Behavior::mootoolsFix();</code> to handle new MooTools files <code class="php"></code></li>
<li>Changed <code class="php">MY_Behavior::mootoolsFix();</code> to correctly render old tooltips format <code>title::text</code> for items with <code>hasTip</code> class (anyway, remember that classes to style the tooltip <a href="http://mootools.net/docs/more/Interface/Tips#Tips:constructor" target="_blank">have changed</a>!)</li>
<li><span style="text-decoration: line-through;">Added a <strong>validate.js</strong> replacement to fix an issue with <a href="http://www.dwightjack.com/diary/2009/02/23/upgrade-mootools-to-v12x-in-joomla-15/comment-page-1/#comment-167" target="_blank">changed namespaces</a>.</span> ( this replacement is no more needed)<span style="text-decoration: line-through;"><br />
 </span></li>
</ol>
<p>The source code is released in the form of patch: unzip it and upload files in your Joomla root, eventually overwriting files. MooTools library is uncompressed to allow for a quicker debug. Anyway you may minify it with your tool of choice.</p>
<p><span style="text-decoration: line-through;">Here is the code: <a href=http://www.dwightjack.com/diary/wp-content/plugins/download-monitor/download.php?id=10>Mootools 1.11 to 1.2.2 (71.68 kB)</a></span></p>
<p><strong>Update (again):</strong> Sometimes i can&#8217;t get if MooTools team is too vital or library milestones are not well defined&#8230; anyway here is an update to use <strong>latest MooTools</strong><strong> 1.2.3</strong>. No major changes have been made to the fix library, anyway keep reporting compatibility issues. Here is the zipped  file: <span style="text-decoration: line-through;"><a href=http://www.dwightjack.com/diary/wp-content/plugins/download-monitor/download.php?id=13>Mootools 1.11 to 1.2.3 for Joomla 1.5 (72.06 kB)</a></span></p>
<p><strong>Update (09/20/09): </strong>New version available. Corrected some bugs in the compatibility file and added a loop check to replace MooTools 1.11 when called from a component as custom script. Now the validation core script doesn&#8217;t need to be replaced. Get source here (carries the original validate.js as in Joomla 1.5.14:  <a href=http://www.dwightjack.com/diary/wp-content/plugins/download-monitor/download.php?id=15>MooTools 1.11 to 1.2.x (72.88 kB)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dwightjack.com/diary/2009/06/07/use-mootools-122-in-joomla-15/feed/</wfw:commentRss>
		<slash:comments>62</slash:comments>
		</item>
		<item>
		<title>Joomla 1.5: Filter mambots and plugins&#8217; codes in PDF and print view</title>
		<link>http://www.dwightjack.com/diary/2009/05/19/joomla-filter-mambots-and-plugins-codes-in-pdf-print-view/</link>
		<comments>http://www.dwightjack.com/diary/2009/05/19/joomla-filter-mambots-and-plugins-codes-in-pdf-print-view/#comments</comments>
		<pubDate>Tue, 19 May 2009 19:28:36 +0000</pubDate>
		<dc:creator>Dwight Jack</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[com_content]]></category>
		<category><![CDATA[joomla]]></category>
		<category><![CDATA[Joomla 1.5]]></category>
		<category><![CDATA[joomla plugin]]></category>

		<guid isPermaLink="false">http://www.dwightjack.com/diary/?p=156</guid>
		<description><![CDATA[Here is an effective and hack-free way to remove mambots and plugins' codes from your content in PDF and print view.]]></description>
			<content:encoded><![CDATA[<p>One of the coolest feature in Joomla content editor is the ability to insert specific modules&#8217; position whereaver you want. This is particularly usefull to load  inline banners or to add quick polls to an article/page just by inserting <code>{loadposition mypostion}</code> in your editor textarea.</p>
<p>In Joomla 1.5.x everything works fine when viewing the page as HTML, but in <strong>PDF and print friendly format</strong> view these shortcodes aren&#8217;t converted nor removed. Moreover displaying these contents could be unnecessary or unwanted.</p>
<p>This problem arise because in pdf and print view files in Joomla <code>com_content</code> component not all content plugins (those addons called <em>mambots</em>) are loaded. In PDF view file <code>components/com_content/views/article/view.pdf.php</code> there&#8217;s just one plugin (called <em>image</em>) loaded before the content is outputted (lines 68 -69):</p>
<pre><code>JPluginHelper::importPlugin('content', 'image');
$dispatcher-&gt;trigger('onPrepareContent', array (&amp; $article, &amp; $params, 0));</code></pre>
<h3>The (dirty) solution</h3>
<p>From a quick glance in the <code>plugins/content</code> folder i&#8217;ve noticed that there&#8217;s no any <code>image.php</code> plugin  file in a clean Joomla 1.5.10 installation. So i&#8217;ve decided to use this <em>hole</em> and create a custom plugin to clean my content without messing up the core <code>com_content</code> code.</p>
<p>After installing the plugin and activating it you are given (at the moment) two options:</p>
<ul>
<li> a radio to clean loadposition code (defaults to <code>Yes</code>)</li>
<li>a textarea for typing custom regular expressions (one per line).</li>
</ul>
<p>In this last field remember to omit backslashes (/) instead write curly brackets, for example <code>{code\s*[a-zA-Z]}</code></p>
<p>Here is the package for download: <a href=http://www.dwightjack.com/diary/wp-content/plugins/download-monitor/download.php?id=8>plg_image (clean plugins code) (1.79 kB)</a></p>
<p>As always feedbacks and suggestions are welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dwightjack.com/diary/2009/05/19/joomla-filter-mambots-and-plugins-codes-in-pdf-print-view/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Fixing PDF button error with SEF in Joomla 1.5</title>
		<link>http://www.dwightjack.com/diary/2009/04/17/fixing-pdf-button-error-sef-joomla/</link>
		<comments>http://www.dwightjack.com/diary/2009/04/17/fixing-pdf-button-error-sef-joomla/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 15:59:43 +0000</pubDate>
		<dc:creator>Dwight Jack</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[joomla]]></category>
		<category><![CDATA[Joomla 1.5]]></category>
		<category><![CDATA[SH404SEF]]></category>

		<guid isPermaLink="false">http://www.dwightjack.com/diary/?p=143</guid>
		<description><![CDATA[One of the weirdest error in Joomla 1.5 is that just turning SEF on makes PDF button stop working in content articles.
This happens with both system and 3rd party components.]]></description>
			<content:encoded><![CDATA[<p>One of the weirdest error in Joomla 1.5 is that just turning SEF on makes PDF button stop working in content articles.<br />
This happens with both system and 3rd party components.</p>
<p>I&#8217;ve recently digged the problem and found that this could be related (kinda randomly) to a bunch of problems and conflicts with other Joomla feature (such as system cache).</p>
<p>In my own projects im using right now <strong>SH404SEF</strong> as SEF component and i&#8217;ve found it&#8217;s a really good piece of software, so here is a recap of the fix/patch for the problem.</p>
<p>First of all <a href="http://extensions.siliana.com/en/Table/sh404SEF-and-url-rewriting/" target="_blank">upgrade SH404</a> to the latest release by downloading it from <a href="http://joomlacode.org/gf/project/sh404sef/frs/" target="_blank">JoomlaCode</a>.</p>
<p>Now open <code>custom.sef.php</code> in <code>administrator/components/com_sh404sef/</code> and search for a line containing:</p>
<pre><code>$shDefaultParams['sh404SEF_PROTECT_AGAINST_DOCUMENT_TYPE_ERROR'] = 0;</code></pre>
<p>and set the paramenter to 1:</p>
<pre><code>$shDefaultParams['sh404SEF_PROTECT_AGAINST_DOCUMENT_TYPE_ERROR'] = 1;</code></pre>
<p>If this line is not present then add it at the end of the file.</p>
<p>Now go to the backend panel in Joomla and purge all SEF url by<em><strong>:</strong></em><strong><em><br />
Components -&gt; SH404SEF -&gt; Purge SEF Urls<br />
</em></strong>then clear the cache by:<br />
<strong><em>Tools -&gt; Clean Cache</em></strong></p>
<p>This will clear all current URLs, so that SH404SEF has to recreate them, anyway your PDF button should work again and the PDF URLs should be as the HTML one with an ending parameter <code>?format=pdf</code>.</p>
<p>Source: <a href="http://extensions.siliana.com/forums/index.php?topic=9509.0" target="_blank">http://extensions.siliana.com/forums/index.php?topic=9509.0</a></p>
<p><em>Note: As a side effect you shouldn&#8217;t problably be able to use the pdf folder feature to store custom PDFs!</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dwightjack.com/diary/2009/04/17/fixing-pdf-button-error-sef-joomla/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Upgrade Mootools to v1.2.x  in Joomla! 1.5</title>
		<link>http://www.dwightjack.com/diary/2009/02/23/upgrade-mootools-to-v12x-in-joomla-15/</link>
		<comments>http://www.dwightjack.com/diary/2009/02/23/upgrade-mootools-to-v12x-in-joomla-15/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 21:10:21 +0000</pubDate>
		<dc:creator>Dwight Jack</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Joomla 1.5]]></category>
		<category><![CDATA[Mootools]]></category>

		<guid isPermaLink="false">http://www.dwightjack.com/diary/?p=101</guid>
		<description><![CDATA[A test case on adding Mootools 1.2 support to current Joomla 1.5.9 release.]]></description>
			<content:encoded><![CDATA[<p>Joomla 1.5 is for sure a great CMS: it features lot of extensions, a rather clean XHTML output and its framework API is really powerfull. Moreover it&#8217;s built with MVC logic in mind, enabling web designers to use template overrides in their themes.</p>
<p>Despite all these advanced features Joomla 1.5 is still stuck at JS framework <strong>Mootools 1.11</strong>. The latest version of this framework, 1.2.x, introduced many new features and a complete re-engineered code. Due to these changes, Joomla developers plan to upgrade Mootools in the 1.6 release, to be able to spread code changes to all plugins, modules and components. Until that release we&#8217;ll be stuck at outdated, unsupported and often undocumented code.</p>
<p>This is an attempt to add <strong><a href="http://mootools.net/">Mootools 1.2</a></strong> support to current Joomla 1.5.9 release. Let&#8217;s start:</p>
<p><strong>Update:</strong> A new version of files presented in this post is available <strong><a href="http://www.dwightjack.com/diary/2009/06/07/use-mootools-122-in-joomla-15/" target="_blank">here</a></strong>!</p>
<h3>Requirements:</h3>
<ol>
<li>Nearly full compatibility with Mootools 1.11 to avoid errors</li>
<li>Upgrade of Mootools plugins where possibile</li>
<li>None or minimal Joomla core hacks</li>
<li>Implementation of Mootools in legacy (1.0.x) components</li>
</ol>
<h3>1. Smooth Mootools upgrade.</h3>
<p>First of all let&#8217;s download the latest version of <strong>Mootools Core and Mootools More</strong> (right now 1.2.1):<a href=http://www.dwightjack.com/diary/wp-content/plugins/download-monitor/download.php?id=4>Mootools 1.2.1 Full (28.51 kB)</a></p>
<p>Unzip the archive and place the two files in <code>media/system/js/</code></p>
<p>Then download this compatibility file, which will make old 1.11 scripts work rather smoothly with the new framework, and place it in the same folder as above (<em>update 05/22/09 added getValue, Json and window.onDomReady compatibility, thanx <a href="http://www.dwightjack.com/diary/2009/02/23/upgrade-mootools-to-v12x-in-joomla-15/comment-page-1/#comment-163">Toopixel</a></em>):</p>
<a href=http://www.dwightjack.com/diary/wp-content/plugins/download-monitor/download.php?id=9>Mootools 1.11 to 1.2.1 Compatibility File (1.97 kB)</a>
<h3>2. Plugins Upgrade.</h3>
<p>One of the more usefull plugin shipped with Mootools is <strong><a href="http://digitarald.de/project/squeezebox/">Squeezebox</a></strong>, used for the modal windows, here is the 1.2 Compatible version, ready to be placed in the above mentioned folder <code>media/system/js/</code>:</p>
<a href=http://www.dwightjack.com/diary/wp-content/plugins/download-monitor/download.php?id=6>Sqeezebox for Mootools 1.2.x (3.37 kB)</a>
<h3>3-4. Let&#8217;s try some PHP</h3>
<p>Since i want to touch Joomla Core files as less as possible, im going to use some little tricks to be able to <strong>use Mootools 1.2 just in the Frontend</strong> and <em>on-demand</em> from the template&#8217;s main <code>index.php</code> file.</p>
<p>Joomla is based on several PHP libraries placed in the <code>libraries/</code> folder; one of them is the <strong>Joomla API</strong>, but we can find <strong>ezSQL</strong> (a database lib), <strong>PHPMailer</strong> (a mailing system) and <strong>phpgacl</strong> (an access list system). To take advantage of Joomla&#8217;s built-in libraries loading system and, at the same time, prevent overwrites by future releases, i created a folder called <code>my_libs</code> in <code>libraries/</code> containing a class file: <a href=http://www.dwightjack.com/diary/wp-content/plugins/download-monitor/download.php?id=7>my_behavior class for Joomla 1.5.9 (1.13 kB)</a></p>
<p>Basically the class provides a static function which recalls the head part of Joomla document object, looks for Mootools and replaces it with the 1.2 version we uploaded before.</p>
<p>If Mootools is not found, then it&#8217;s simply loaded, extending it&#8217;s presence in the head of legacy 1.0.x components.</p>
<p>You can call this newly added class in your Joomla theme <code>index.php</code> by placing these lines of code before the head template tag:</p>
<pre><code>&lt;?php
JLoader::import( 'my_libs.behavior' );
MY_Behavior::mootoolsFix();
?&gt;
&lt;jdoc:include type="head" /&gt;</code></pre>
<p>If you need to switch back to v1.11 you can pass <code>false</code> as first argument to the function like this:</p>
<pre><code>MY_Behavior::mootoolsFix(false);</code></pre>
<h3>Note this!</h3>
<p>This is just a test, <strong>it should work on a basic Joomla installation</strong>, anyway feel free to report errors and issues to improve the code.</p>
<p>Untill now, I&#8217;ve experienced that <strong>Virtuemart</strong> uses it&#8217;s own logic to load libraries, so it&#8217;s <strong>excluded by default</strong>.</p>
<p>Optionally you can exclude specific components by passing an array with their option value as second argument:</p>
<pre><code>MY_Behavior::mootoolsFix(true,array("com_sobi2","com_comprofiler"));</code></pre>
<p>In <strong>SOBI2</strong> an error will be issued on search form unless you set the registry option <code>use_own_mootools</code> to <code>0</code>.</p>
<pre></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.dwightjack.com/diary/2009/02/23/upgrade-mootools-to-v12x-in-joomla-15/feed/</wfw:commentRss>
		<slash:comments>53</slash:comments>
		</item>
	</channel>
</rss>
