<?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>Notes Log &#187; PHP</title>
	<atom:link href="http://noteslog.com/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://noteslog.com</link>
	<description></description>
	<lastBuildDate>Sat, 15 May 2010 13:31:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>How to show a slow loading page</title>
		<link>http://noteslog.com/post/how-to-show-a-slow-loading-page/</link>
		<comments>http://noteslog.com/post/how-to-show-a-slow-loading-page/#comments</comments>
		<pubDate>Sun, 05 Apr 2009 22:52:59 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[Fixing]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://noteslog.com/?p=343</guid>
		<description><![CDATA[Problem &#8211; Slow loading pages are frustrating, for web users and developers too. Of course there are many possible tweaks you can use to speed them up, but sometimes you cannot optimize a page any further. UPDATED 2009-10-11 Solution &#8211; If you can&#8217;t beat them, join them. You can show a progress indicator to let your [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong> &#8211; Slow loading pages are frustrating, for web users and developers too. Of course there are many possible tweaks you can use to speed them up, but sometimes you cannot optimize a page any further.</p>
<ul>
<li>UPDATED 2009-10-11</li>
</ul>
<p><span id="more-343"></span></p>
<p><strong>Solution</strong> &#8211; If you can&#8217;t beat them, join them. You can show a progress indicator to let your web users know that your server is thinking hard the answer to their request, but how do you do that?</p>
<p><strong>Requirement 1</strong> &#8211; You cannot put the progress indicator on the leaving page, because you don&#8217;t want to modify every single reference to a slow page. It doesn&#8217;t make sense either: a slow page is slow by itself! You really don&#8217;t need that coupling.</p>
<p><strong>Requirement 2</strong> - You cannot put the progress indicator on the landing page, the slow one, because the browser needs it before the slow page has arrived. If they arrive together, the progress indicator is useless!</p>
<p>There is a <a href="http://www.aspnetpro.com/NewsletterArticle/2003/08/asp200308bm_l/asp200308bm_l.asp" target="_blank">good article</a> about this issue but it fails at implementing the first requirement. Anyway that was the idea I worked on when starting this project.</p>
<p>Here is the waiting page that get&#8217;s loaded while loading the slow page. For browsers other than IE, the trick is to change the document.location.href property after loading the <a href="http://ajaxload.info/" target="_blank">progress indicator</a> image. In IE we change the document.location.href and then add the image.</p>
<p>I used jQuery to make it simple.</p>
<p><strong>waiting.php</strong></p>
<p><pre class="chili-all"><code class="html">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;DTD/xhtml1-transitional.dtd&quot;&gt;

&lt;html xml:lang=&quot;en&quot; lang=&quot;en&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;&lt;head&gt;

&lt;title&gt;Loading Page...&lt;/title&gt;

&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;</code><code class="javascript">
jQuery( function( $ ) {
	function redirect() {
		$('form').submit();
	}
	
	if($.browser.msie) {
		redirect();
		$('img').appendTo('body').attr('src', 'loading-page.gif');
	} else {
		$('#loading').bind('load', function() {
	        redirect();
	    }).attr('src', 'loading-page.gif');
	}
} );
</code><code class="html">&lt;/script&gt;

&lt;/head&gt;&lt;body&gt;

&lt;h1&gt;Loading Page...&lt;/h1&gt;
&lt;img id=&quot;loading&quot; /&gt;
&lt;form method=&quot;&lt;?php </code><code class="php">echo $method </code><code class="html">?&gt;&quot; action=&quot;&lt;?php </code><code class="php">echo $url </code><code class="html">?&gt;&quot;&gt;
 &lt;input type=&quot;hidden&quot; name=&quot;waiting&quot; value=&quot;&lt;?php </code><code class="php">echo $waiting </code><code class="html">?&gt;&quot; /&gt;
&lt;/form&gt;

&lt;/body&gt;&lt;/html&gt;</code></pre>


</p>
<p>And here is the slow page.</p>
<p><strong>slow-page.php</strong></p>
<p><pre class="chili-all"><code class="html">&lt;?php
</code><code class="php">
if ( ! isset($_REQUEST['waiting']) ) {
    $url = htmlspecialchars( $_SERVER['REQUEST_URI'] );
	$method = $_SERVER['REQUEST_METHOD'];
	$waiting = time();
	include &quot;waiting.php&quot;;
    return;
}

sleep(10); //simulate a slow task

</code><code class="html">?&gt;

&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;DTD/xhtml1-transitional.dtd&quot;&gt;

&lt;html xml:lang=&quot;en&quot; lang=&quot;en&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;&lt;head&gt;
 &lt;title&gt;Slow Page&lt;/title&gt;
&lt;/head&gt;&lt;body&gt;
 &lt;h1&gt;Hello World!&lt;/h1&gt;
&lt;/body&gt;&lt;/html&gt;</code></pre>


</p>
<p>You can test it <a href="http://noteslog.com/personal/projects/page-loading/3/slow-page.php" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/how-to-show-a-slow-loading-page/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>How to setup your web development environment</title>
		<link>http://noteslog.com/post/how-to-setup-your-web-development-environment/</link>
		<comments>http://noteslog.com/post/how-to-setup-your-web-development-environment/#comments</comments>
		<pubDate>Sun, 01 Feb 2009 20:19:14 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[Toolkit]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Eclipse PDT]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WampServer]]></category>
		<category><![CDATA[Zend Debugger]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://noteslog.com/?p=318</guid>
		<description><![CDATA[If you want to setup a web development environment in your PC, there are many options out there, so I&#8217;m going to describe the one that just worked for me. This is a no-frills tutorial about how to setup a web development environment for PHP, using  An EeePC 1000H as the local machine A wireless [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to setup a web development environment in your PC, there are many options out there, so I&#8217;m going to describe the one that just worked for me.</p>
<p>This is a no-frills tutorial about how to setup a web development environment for PHP, using <span id="more-318"></span></p>
<ul>
<li>An EeePC 1000H as the local machine</li>
<li>A wireless ADSL network for the internet connection</li>
<li>WinXP/SP3 Home as the operating system</li>
<li>Apache as the web server</li>
<li>MySQL as the database management system</li>
<li>PHP as the source language</li>
<li>Subversion and Tortoise for source control management</li>
<li>Eclipse PDT as the integrated development environment</li>
<li>Zend Debugger for remote debugging</li>
<li>Zend Framework as the supporting framework</li>
</ul>
<h3></h3>
<h3>A PC connected to the internet</h3>
<p>This is easy, you already have it, or you should. Mine is the <a href="http://eeepc.asus.com/" target="_blank">EeePC</a>, with <a href="http://www.microsoft.com/windowsxp/home/default.mspx" target="_blank">WinXP Home</a>.</p>
<h3>Apache, MySQL, PHP</h3>
<p>This is very easy too. There are many all-in-one packages, but I feel at home with the <a title="All in one for Apache, MySQL, and PHP" href="http://www.wampserver.com/en/" target="_blank">WampServer</a>.</p>
<ul>
<li>Download and install the WampServer 2.0</li>
</ul>
<p>These versions are currently bundled:  <a href="http://httpd.apache.org/" target="_blank">Apache</a> 2.2.11, <a href="http://www.mysql.com/" target="_blank">MySQL</a> 5.1.30, <a href="http://www.php.net/" target="_blank">PHP</a> 5.2.8, <a href="http://www.phpmyadmin.net/" target="_blank">phpMyAdmin</a> 3.1.1</p>
<h3>Subversion and Tortoise</h3>
<p><a href="http://xp-dev.com/" target="_blank">XP-Dev</a> is my choice for <a href="http://subversion.tigris.org/" target="_blank">Subversion</a> hosting. Easy to setup and free. Nobody else will get access to your code by default, but you can change it as needed. Slick interface, fast updates and commits, (apparently) trustworthy.</p>
<ul>
<li>Create your account at XP-Dev. You&#8217;ll currently get 1500 MB of svn hosting space.</li>
<li>Login and create your first repository. Its name will be &lt;your XP-Dev account&gt;_&lt;your repository name&gt;</li>
</ul>
<p><a href="http://tortoisesvn.tigris.org/" target="_blank">Tortoise</a> is my choice for the svn administration. Easy to setup and free (again).</p>
<ul>
<li>Download and install Tortoise.</li>
</ul>
<p>Tortoise is for dummies like me. Just righ click in a folder and the contextual menu will show all the needed options.</p>
<ul>
<li>Create a local folder for mirroring your remote project repository. Don&#8217;t put it under the www folder of Apache.</li>
<li>Checkout the repository there. This will setup the link between them.</li>
<li>Into the local folder create the classical trunk, tags, and branches folders.</li>
<li>Commit all back to the repository, together with a nice comment.</li>
</ul>
<p>If all goes well, your new source control management system is correctly setup.</p>
<h3>Eclipse PDT</h3>
<p><a href="http://www.eclipse.org/pdt/" target="_blank">Eclipse PDT</a> is my preferred <a href="http://en.wikipedia.org/wiki/Integrated_development_environment" target="_blank">IDE</a> for PHP. There&#8217;s an all-in-one distribution, that&#8217;s very easy to setup. Well, it couldn&#8217;t be easier: no setup at all.</p>
<ul>
<li><a href="http://www.java.com/" target="_blank">Download</a> and install Java</li>
<li><a href="http://downloads.zend.com/pdt/all-in-one/" target="_blank">Download</a> and unzip Eclipse PDT into the root of a disk unit, like C:</li>
</ul>
<p>It&#8217;s important that you unzip into the root, otherwise some files won&#8217;t unzip due their long path names. Eventually, you&#8217;ll get an eclipse folder, containing an eclipse executable.</p>
<ul>
<li>Start eclipse and learn <a href="http://www.youtube.com/watch?v=VRFZpk-YHl4" target="_blank">how to</a> <a href="http://www.youtube.com/watch?v=x8WnciHjXco" target="_blank">move around</a>.</li>
<li>Create a new PHP project, into the trunk folder.</li>
<li>Open the trunk folder from WinXP and add to the ignore list of Tortoise all the files automatically created by eclipse. Then commit.</li>
</ul>
<h3></h3>
<h3>Zend Debugger</h3>
<p>Even if you think that the Zend Debugger was bundled with the all-in-one Eclipse PDT, follow this step too. In fact, that Zend Debugger is not for server debugging, while this one is.</p>
<ul>
<li><a href="http://downloads.zend.com/pdt/server-debugger/" target="_blank">Download</a> and unzip Zend Debugger.</li>
<li>Follow the short instructions of the readme file to intall it. For 	editing the php.ini, use the link provided by WampServer.</li>
</ul>
<h3></h3>
<h3>Zend Framework</h3>
<p>You could use any other framework, or no framework at all, but I know the <a href="http://framework.zend.com/" target="_blank">Zend Framework</a> quite a bit.</p>
<ul>
<li>Download and unzip the Zend Framework.</li>
</ul>
<p>The Zend Framework site provides a <a href="http://framework.zend.com/docs/quickstart" target="_blank">QuickStart</a> tutorial that sets up an &#8220;Hello World&#8221; application.</p>
<ul>
<li>Activate in Apache (WampServer) the rewrite module.</li>
<li>Create in Apache (WampServer) an alias from &#8216;project&#8217; (trim apostrophes) to the trunk folder of 	your project.</li>
<li>Go back to the IDE and code in the QuickStart tutorial. Don&#8217;t put the ZF library into the trunk/library folder. Instead leave it where it is and put its path into the include_path 	directive of php.ini, using WampServer.</li>
</ul>
<p>That&#8217;s much better, because your current ZF library version won&#8217;t replicate by means of svn to your remote repository, and when a new version will be available, you can change the include_path directive to point to it, and change it back if something goes wrond (sometimes it does), without moving files around.</p>
<p>Moreover, you can use the trunk/library folder for your own library files. I suggest a personal folder for your reusable classes like forms, elements, filters, and validators, and a Zend folder that mirrors the Zend Framework when you need to fix a bug in a class, or hack something into the ZF library.</p>
<p>Due to the fact that the PHP interpreter will scan the trunk/library folder before the external ZF library folder (if you set up the include_path as shown in the QuickStart tutorial), you can &#8220;overwrite&#8221; the ZF library classes with your copies if you need, on the fly, maintaining them well apart.</p>
<h3>First debugging session</h3>
<p>Now your web development environment should be setup and you can start your first debugging session.</p>
<ul>
<li>Open the home page http://localhost/project/ in a browser.</li>
<li>Start the debugger at that page, using Eclipse PDT. Check that the URL into the Debug Configuration dialog is correct, and the option &#8216;Break at first line&#8217; is checked.</li>
<li>Explore 	the code step by step.</li>
<li>If 	all is OK then commit, else fix bugs.</li>
</ul>
<h3></h3>
<h3>Start developing</h3>
<p>That&#8217;s alll. Now it&#8217;s up to you.</p>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/how-to-setup-your-web-development-environment/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Enzymes 2.0 Released Today</title>
		<link>http://noteslog.com/post/enzymes-20-released-today/</link>
		<comments>http://noteslog.com/post/enzymes-20-released-today/#comments</comments>
		<pubDate>Sat, 10 Nov 2007 22:55:43 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[Enzymes]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://noteslog.com/post/enzymes-20-released-today/</guid>
		<description><![CDATA[Enzymes is a WordPress Plugin for retrieving properties and custom fields of posts, pages, and authors, right into the visual editor of posts and pages, and everywhere else. I&#8217;m releasing now Enzymes 2.0 which is quite a step forward. The features are a new syntax for retrieving properties of posts, pages, and authors; as well [...]]]></description>
			<content:encoded><![CDATA[<p>Enzymes is a WordPress Plugin for retrieving properties and custom fields of posts, pages, and authors, right into the visual editor of posts and pages, and everywhere else.</p>
<p>I&#8217;m releasing now Enzymes 2.0 which is quite a step forward. The features are</p>
<ul>
<li>a new syntax for retrieving properties of posts, pages, and authors; as well as the old syntax for custom fields</li>
<li>a new syntax for identifying posts and pages by means of their slugs; as well as the old syntax with their numbers</li>
<li>a new <u>elaborate</u> method allowing for an easier processing of indirect arguments</li>
<li>a new <u>merging</u> method helping at crafting how the pathway is built by evaluation enzymes</li>
<li>slash and backslash templating uniformly supported by transclusion and evaluation enzymes</li>
<li>a cleaner code</li>
<li><a href="http://noteslog.com/enzymes/">a new manual</a></li>
<li>new examples</li>
</ul>
<h5>A WordPress Plugin</h5>
<p>This version is available for <a href="http://wordpress.org/extend/plugins/enzymes/">download</a> from wordpress.org</p>
<h5>The previous version</h5>
<p>I released Enzymes 1.2 one year ago from mondotondo.com, and re-released it as version 1.3 one month ago from wordpress.org. Both were almost the same thing. Here are the only differences:</p>
<ul>
<li>updated the description header, accounting for the new address (notelog.com)</li>
<li>removed the signals to my server for activation / deactivation of the plugin</li>
<li>packaged as a wordpress plugin, available for download from wordpress.org</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/enzymes-20-released-today/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to add semantics to WordPress posts</title>
		<link>http://noteslog.com/post/how-to-add-semantics-to-wordpress-posts/</link>
		<comments>http://noteslog.com/post/how-to-add-semantics-to-wordpress-posts/#comments</comments>
		<pubDate>Fri, 02 Mar 2007 09:49:35 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[Enzymes]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://noteslog.com/?p=151</guid>
		<description><![CDATA[Browsing the WordPress&#8217; ideas repository I&#8217;ve found one that could make WordPress fill the gap between a blog tool and a knowledge base: Structured Blogging. The fact that it got 60 votes but only 50% stars means two things: voting people are lazy thinkers it&#8217;s a difficult task at many levels Nonetheless it&#8217;s a good [...]]]></description>
			<content:encoded><![CDATA[<p>Browsing the WordPress&#8217; <a href="http://wordpress.org/extend/ideas/" target="_blank">ideas repository</a> I&#8217;ve found one that could make <a href="http://wordpress.org/" target="_blank">WordPress</a> fill the gap between a blog tool and a knowledge base: <a href="http://wordpress.org/extend/ideas/topic.php?id=217" target="_blank">Structured Blogging</a>.</p>
<p>The fact that it got 60 votes but only 50% stars means two things:</p>
<ol>
<li>voting people are lazy thinkers</li>
<li>it&#8217;s a difficult task at many levels</li>
</ol>
<p>Nonetheless it&#8217;s a good idea because this is and will be for many years to come the blogging era, where millions of authors <strong>post</strong> content to the Internet. There is no good reason for that content to be unstructured except lazyness and complexity.</p>
<p>Nothing can be done about lazyness but complexity can be substantially reduced. The solution needs:</p>
<ul>
<li>a mechanism for adding XML tags from some dictionary</li>
<li>a template system for showing XML content appropiately</li>
</ul>
<p>On the path to something readily usable (I hope Matt will provide it in WordPress 3.0), a mechanism could be a <a href="http://docs.jquery.com/Plugins" target="_blank">jQuery plugin</a> for the visual editor, and a template system could be based on <a href="/?page_id=77" target="_blank">Enzymes</a>.</p>
<h4>Autocompletion</h4>
<p>I think that <a href="http://tinymce.moxiecode.com/" target="_blank">tinyMCE</a> can be extended by plugins, but I don&#8217;t know how to. <a href="http://jquery.com/" target="_blank">jQuery</a> itself has an <a href="http://www.dyve.net/jquery/?autocomplete" target="_blank">autocompletion plugin</a> that could be used this way. When an author presses a &lt; key, the <a href="http://en.wikipedia.org/wiki/Autocompletion" target="_blank">autocompletion</a> gets triggered and the popup &#8230; pops up :-)</p>
<p>If you have ever used <a href="http://www.microsoft.com/windows/ie/ie6/downloads/recommended/ime/default.mspx" target="_blank">IME</a> (for Japanese for example), you should know what I mean. Options are organized in a hierarchy and you get the most relevant at the top, depending on the few characters already typed. XML dictionaries could be ajaxed and locally cached; they could be plugins that you install into your blog, or be web services too; they could be <a href="http://dublincore.org/" target="_blank">international standards</a> compliant or be completely custom.</p>
<p>The most-relevant-first feature of the autocompletion popup would be a big help for authors. If I already opened a Tag, then the most relevant options after pressing &lt; could be:</p>
<ol>
<li>the closing tag for that Tag</li>
<li>any tag that could be inside that Tag (properly sorted if needed)</li>
<li>any root of the cached dictionaries (if possible in Tag)</li>
<li>an option for accessing additional dictionaries (if possible in Tag)</li>
</ol>
<h4>Templates</h4>
<p>A PHP template for properly rendering XML content is very easy to write, and Enzymes could be used in the clockwork. In fact an Enzymes feature is the possibility of easily transcluding all the content of a post or a page by means of the special char *</p>
<p>The XML to HTML template can be transformed in an Enzymes template with a couple of PHP instructions, thus allowing you to almost copy and paste already available templates. Then you could apply a solution like this:</p>
<ol>
<li>write a private post or page with the XML content, using the autocompletion feature described above (say this post is #123)</li>
<li>write a public post or page with the Enzymes statement {[123.* /template.php]} in its content</li>
</ol>
<p>The post in 1. needs to be private because you don&#8217;t want it to appear on the blog as is, and 2. makes the transformation happen. As an added benefit, you can display that semantic content inside of a greater context, and you can transclude it wherever you want in your WordPress blog (as many times as you like).</p>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/how-to-add-semantics-to-wordpress-posts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Highlight Mixed Language Source Code</title>
		<link>http://noteslog.com/post/mixed-language-snippets/</link>
		<comments>http://noteslog.com/post/mixed-language-snippets/#comments</comments>
		<pubDate>Fri, 16 Feb 2007 15:35:29 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[Chili]]></category>
		<category><![CDATA[Enzymes]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://noteslog.com/?p=143</guid>
		<description><![CDATA[Web pages contain many snippets from different languages, like HTML, PHP, CSS, and JavaScript. Chili 1.x cannot highlight mixed language source code automatically, but the forthcoming released Chili 2.0 will be is able to do that. Meanwhile, if you are using a Chili + Enzymes setup, then it&#8217;s possible to write an Enzymes template capable [...]]]></description>
			<content:encoded><![CDATA[<p>Web pages contain many snippets from different languages, like HTML, PHP, CSS, and JavaScript. Chili 1.x cannot highlight mixed language source code automatically, but the <span style="text-decoration: line-through;">forthcoming</span> released <a href="http://noteslog.com/post/chili-20-released-today/">Chili 2.0</a> <span style="text-decoration: line-through;">will be</span> is able to do that.</p>
<p>Meanwhile, if you are using a Chili + Enzymes setup, then it&#8217;s possible to write an Enzymes template capable of making Chili 1.x highlight a web page perfectly (expanding on my previous php template).</p>
<p>Here is the <span style="text-decoration: line-through;">new</span> updated (2007/02/19) <span style="text-decoration: underline;">chili-web.php</span> Enzymes template. At the moment it supports XHTML, and embedded CSS, JavaScript, and PHP snippets.</p>
<p><?php 
if( ! function_exists( 'format_code' ) ) {

	function snippet_wrap( $class, $code ) {
		return '' == $code ? '' : '<code class="'.$class.'">'.htmlentities( $code ).'</code>';
	}

	function snippet_php( $open, $code, $close ) {
		return snippet_wrap( 'html', $open ).snippet_wrap( 'php', $code ).snippet_wrap( 'html', $close );
	}

	function php_inside_html( $matches ) {
		list( $all, $before, $open, $code, $close ) = $matches;

		if( '' == $open ) 
			return snippet_wrap( 'html', $all );
		else 
			return snippet_wrap( 'html', $before ).snippet_php( $open, $code, $close );
	}

	function php_inside_css( $matches ) {
		list( $all, $before, $open, $code, $close ) = $matches;

		if( '' == $open ) 
			return snippet_wrap( 'css', $all );
		else 
			return snippet_wrap( 'css', $before ).snippet_php( $open, $code, $close );
	}

	function php_inside_javascript( $matches ) {
		list( $all, $before, $open, $code, $close ) = $matches;

		if( '' == $open ) 
			return snippet_wrap( 'javascript', $all );
		else 
			return snippet_wrap( 'javascript', $before ).snippet_php( $open, $code, $close );
	}

	function php_inside( $class, $code ) {
		return preg_replace_callback( '/(?:(.*?)(\<\?php\s)(.*?)(\?\>))|(?:.+)/si', "php_inside_$class", $code );
	}

	function snippet_web( $class, $open, $code, $close ) {
		return snippet_wrap( 'html', $open ).php_inside( $class, $code ).snippet_wrap( 'html', $close );
	}

	function format_code( $matches ) {
		list( $all, $before, $open, $tag, $code, $close ) = $matches;

		if( '' == $open ) {
			return php_inside( 'html', $all );
		}
		else {
			switch( $tag ) {
				case 'script': $class = 'javascript'; break;
				case 'style' : $class = 'css';        break;
				default      : $class = 'html';
			}
			return php_inside( 'html', $before ).snippet_web( $class, $open, $code, $close );
		}
	}

	function format_clean( $out ) {
		do {
			$len = strlen( $out );
			$out = preg_replace( '/(\<code class="(\w+)"\>[^<]*)\<\/code\>\<code class="\2"\>/is', '$1', $out );
		} while( $len != strlen( $out ) );
		return $out;
	}
}

?>
<pre class="chili-<?php 
	$tmp = preg_split( '/(?:\r?\n)+/', $this->result );
	if( count( $tmp ) > 28 ) echo 'clip';
	else echo 'all'; 
?>"><?php
	$out = preg_replace_callback( '/(?:(.*?)(\<(script|style)\b.*?\>)(.*?)(\<\/\3\>))|(?:.+)/is', 'format_code', $this->result );
	echo format_clean( $out );
?></pre></p>
<p>The WordPress file <span style="text-decoration: underline;">/wp-content /themes /default /comments-popup.php</span> is a page that uses all the supported languages, so it&#8217;s a good test for the previous template:</p>
<p><?php
/* Don't remove these lines. */
add_filter('comment_text', 'popuplinks');
while ( have_posts()) : the_post();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
     <title><?php echo get_option('blogname'); ?> - Comments on <?php the_title(); ?></title>

	<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
	<style type="text/css" media="screen">
		@import url( <?php bloginfo('stylesheet_url'); ?> );
		body { margin: 3px; }
	</style>

</head>
<body id="commentspopup">

<h1 id="header"><a href="" title="<?php echo get_option('blogname'); ?>"><?php echo get_option('blogname'); ?></a></h1>

<h2 id="comments">Comments</h2>

<p><a href="<?php echo get_option('siteurl'); ?>/wp-commentsrss2.php?p=<?php echo $post->ID; ?>"><abbr title="Really Simple Syndication">RSS</abbr> feed for comments on this post.</a></p>

<?php if ('open' == $post->ping_status) { ?>
<p>The <abbr title="Universal Resource Locator">URL</abbr> to TrackBack this entry is: <em><?php trackback_url() ?></em></p>
<?php } ?>

<?php
// this line is WordPress' motor, do not delete it.
$commenter = wp_get_current_commenter();
extract($commenter);
$comments = get_approved_comments($id);
$post = get_post($id);
if (!empty($post->post_password) && $_COOKIE['wp-postpass_'. COOKIEHASH] != $post->post_password) {  // and it doesn't match the cookie
	echo(get_the_password_form());
} else { ?>

<?php if ($comments) { ?>
<ol id="commentlist">
<?php foreach ($comments as $comment) { ?>
	<li id="comment-<?php comment_ID() ?>">
	<?php comment_text() ?>
	<p><cite><?php comment_type('Comment', 'Trackback', 'Pingback'); ?> by <?php comment_author_link() ?> â€” <?php comment_date() ?> @ <a href="#comment-<?php comment_ID() ?>"><?php comment_time() ?></a></cite></p>
	</li>

<?php } // end for each comment ?>
</ol>
<?php } else { // this is displayed if there are no comments so far ?>
	<p>No comments yet.</p>
<?php } ?>

<?php if ('open' == $post->comment_status) { ?>
<h2>Leave a comment</h2>
<p>Line and paragraph breaks automatic, e-mail address never displayed, <acronym title="Hypertext Markup Language">HTML</acronym> allowed: <code><?php echo allowed_tags(); ?></code></p>

<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
	<p>
	  <input type="text" name="author" id="author" class="textarea" value="<?php echo $comment_author; ?>" size="28" tabindex="1" />
	   <label for="author">Name</label>
	<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
	<input type="hidden" name="redirect_to" value="<?php echo attribute_escape($_SERVER["REQUEST_URI"]); ?>" />
	</p>

	<p>
	  <input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="28" tabindex="2" />
	   <label for="email">E-mail</label>
	</p>

	<p>
	  <input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="28" tabindex="3" />
	   <label for="url"><abbr title="Universal Resource Locator">URL</abbr></label>
	</p>

	<p>
	  <label for="comment">Your Comment</label>
	<br />
	  <textarea name="comment" id="comment" cols="70" rows="4" tabindex="4"></textarea>
	</p>

	<p>
	  <input name="submit" type="submit" tabindex="5" value="Say It!" />
	</p>
	<?php do_action('comment_form', $post->ID); ?>
</form>
<?php } else { // comments are closed ?>
<p>Sorry, the comment form is closed at this time.</p>
<?php }
} // end password check
?>

<div><strong><a href="javascript:window.close()">Close this window.</a></strong></div>

<?php // if you delete this the sky will fall on your head
endwhile;
?>

<!-- // this is just the end of the motor - don't touch that line either :) -->
<?php //} ?>
<p class="credit"><?php timer_stop(1); ?> <cite>Powered by <a href="http://wordpress.org/" title="Powered by WordPress, state-of-the-art semantic personal publishing platform"><strong>Wordpress</strong></a></cite></p>
<?php // Seen at http://www.mijnkopthee.nl/log2/archive/2003/05/28/esc(18) ?>
<script type="text/javascript">
<!--
document.onkeypress = function esc(e) {
	if(typeof(e) == "undefined") { e=event; }
	if (e.keyCode == 27) { self.close(); }
}
// -->
</script>
</body>
</html></p>
<p>Chili &amp; Enzymes confirm to be a perfect match.</p>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/mixed-language-snippets/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Enzymes 1.2 Released Today</title>
		<link>http://noteslog.com/post/enzymes-12-released-today/</link>
		<comments>http://noteslog.com/post/enzymes-12-released-today/#comments</comments>
		<pubDate>Mon, 25 Dec 2006 14:48:01 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[Enzymes]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://noteslog.com/?p=96</guid>
		<description><![CDATA[Changes Fixed a bug inÂ the metabolism outside a post. For example,Â a title transcluding a custom fieldÂ by means of anÂ implicit reference rendered correctly when viewing the post but not when the title appeared in a list of post titles. Files download all in a zip read the manual]]></description>
			<content:encoded><![CDATA[<p><strong>Changes</strong></p>
<ul>
<li>Fixed a bug inÂ the metabolism outside a post. For example,Â a title transcluding a custom fieldÂ by means of anÂ implicit reference rendered correctly when viewing the post but not when the title appeared in a list of post titles.</li>
</ul>
<p><strong>Files</strong></p>
<ul>
<li><a href="/personal/projects/enzymes/1.2/enzymes-1.2-all.zip" onclick="javascript:urchinTracker('/downloads/enzymes-1.2');">download all in a zip</a></li>
<li><a href="/enzymes/">read the manual</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/enzymes-12-released-today/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>AdSense Enzymes</title>
		<link>http://noteslog.com/post/adsense-enzymes/</link>
		<comments>http://noteslog.com/post/adsense-enzymes/#comments</comments>
		<pubDate>Wed, 06 Dec 2006 08:26:39 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[Enzymes]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://noteslog.com/?p=93</guid>
		<description><![CDATA[AdSense Enzymes areÂ very simple. At the simplest level of abstraction, I can directly trascludeÂ the custom fieldÂ whichÂ I&#8217;ve stored the ad code into. AndÂ I can doÂ itÂ either byÂ means ofÂ a statement into the content of a post or a page, or byÂ means of a call to the metabolize function (available in Enzymes 1.1)Â into the php code of a WordPress [...]]]></description>
			<content:encoded><![CDATA[<p>AdSense Enzymes areÂ very simple.</p>
<p>At the simplest level of abstraction, I can directly trascludeÂ the custom fieldÂ whichÂ I&#8217;ve stored the ad code into. AndÂ I can doÂ itÂ either byÂ means ofÂ a statement into the content of a post or a page, or byÂ means of a call to the metabolize function (available in Enzymes 1.1)Â into the php code of a WordPress template file.</p>
<p>The former methodÂ isÂ useful when I want to place an ad unit in a particular/variable position inside the content of a post or a page; the latter method is useful when I want to place an ad unit in a general/constant position inside the blog.</p>
<p>For example, if I put the statement <u>{[1.ad001]}</u> here,Â itÂ would reproduce by itselfÂ the ad unit right here, becauseÂ in the firstÂ postÂ I&#8217;ve storedÂ the ad codeÂ inÂ a custom field called <u>ad001</u>. But toÂ makeÂ the ad unitÂ appear before any post, IÂ need toÂ find the line in the <u>index.php</u> file of my default theme that reads</p>
<p><?php if (have_posts()) : ?></p>
<p>and replace it with this line</p>
<p><?php metabolize( "{[1.ad001]}" ); if (have_posts()) : ?></p>
<p>Taking theÂ abstraction one step further,Â I&#8217;d like to storeÂ the string <u>1.ad001</u> in a new <u>home</u> field, so that I can provide a separation layer that makes it possible for me to replace the ad code simply by changing the content ofÂ a field, rather than having to change the phpÂ file again.</p>
<p>Indirect transclusion is not directly available inÂ Enzymes, but it can be easily achieved by means of a simple enzyme like this</p>
<p>preg_match( '/'.$this->e['substrate'].'/', $this->substrate, $matches );
return $this->item( $matches['sub_id'], $matches['sub_key'] );</p>
<p>I&#8217;ve called this enzyme <u>get</u>, and I&#8217;ve put it intoÂ the first post.Â So the Enzymes statement becomes <u>{[1.get(1.home)]}</u> and theÂ edited line for the <u>index.php</u> file becomes</p>
<p><?php metabolize( "{[1.get(1.home)]}" ); if (have_posts()) : ?></p>
<p>I&#8217;m currently using the latter for my blog home, so I don&#8217;t have to worry about placing ads every time I post a new log, andÂ the former for my pages, so that I can place the ads insdide the content, in a position that I hope will fit better.</p>
<p>Why does Google <a href="https://www.google.com/adsense/support/bin/answer.py?answer=10541&#038;topic=8437" target="_blank">limit to three</a> the number of ad units per page? Is it a technical reason?</p>
<p>Â </p>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/adsense-enzymes/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Enzymes 1.1 Released Today &#8211; updated</title>
		<link>http://noteslog.com/post/enzymes-11-released-today/</link>
		<comments>http://noteslog.com/post/enzymes-11-released-today/#comments</comments>
		<pubDate>Fri, 01 Dec 2006 23:06:11 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[Enzymes]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://noteslog.com/?p=90</guid>
		<description><![CDATA[Changes the title and the excerpt are now directly supported, together with the content any location of a WordPress theme is now supported Example open the php file you are interested in (eg: sidebar.php) select the location where you want the enzyme&#8217;s result to appear (eg: before the last closing &#8216;div&#8217;) paste there a code [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Changes</strong></p>
<ul>
<li>the <u>title</u> and the <u>excerpt</u> are now directly supported, together with the content</li>
<li><u>any location</u> of a WordPress theme is now supported</li>
</ul>
<blockquote><p>Example</p>
<ul>
<li>open the php file you are interested in (eg: sidebar.php)</li>
<li>select the location where you want the enzyme&#8217;s result to appear (eg: before the last closing &#8216;div&#8217;)</li>
<li>paste there a code like this<br />
<u><?php metabolize( "{[456.say(123.hello)]}" ); ?></u></li>
<li>save and test</li>
</ul>
</blockquote>
<ul>
<li>generic custom field keys are now supported. Just wrap your international, multiworded key in a pair of &#8216;=&#8217; and you are done (any &#8216;=&#8217; your key may include must be escaped by &#8216;\&#8217;)</li>
</ul>
<blockquote><p>Example</p>
<ul>
<li>escaped: <u>{[.=æ°´=]}</u></li>
<li>metabolized: <u>mizu (æ°´) means water</u></li>
</ul>
</blockquote>
<ul>
<li>no bug fixes, hence no need to upgrade, except for getting the new features</li>
<li>backward compatibility preserved, hence no reason not to upgrade :-)</li>
</ul>
<p><strong>Files</strong></p>
<ul>
<li>download all in a zip</li>
<li><a href="/?page_id=77">read the manual</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/enzymes-11-released-today/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Entity enzyme, or The pacman effect strikes back</title>
		<link>http://noteslog.com/post/entity-enzyme-or-the-pacman-effect-strikes-back/</link>
		<comments>http://noteslog.com/post/entity-enzyme-or-the-pacman-effect-strikes-back/#comments</comments>
		<pubDate>Thu, 09 Nov 2006 16:18:27 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[Enzymes]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://noteslog.com/?p=83</guid>
		<description><![CDATA[This is so much aÂ basic enzyme,Â as it is also necessary for what it does. If you want to represent an HTML entity in a post, you&#8217;re going to struggle with the escaping / unescaping issue. For example, to writeÂ that an ampersand is represented by an ampersand followed by &#8216;amp;&#8217; is not as visually appealing as [...]]]></description>
			<content:encoded><![CDATA[<p>This is so much aÂ basic enzyme,Â as it is also necessary for what it does.</p>
<p>If you want to represent an HTML entity in a post, you&#8217;re going to struggle with the escaping / unescaping issue.</p>
<p>For example, to writeÂ that an ampersand is represented by an ampersand followed by &#8216;amp;&#8217; is not as visually appealing as it is to show it right away,Â like &#038; = &amp;amp;</p>
<p>You begin this adventure by writing &#038; = &amp;amp; and after aÂ Save and Continue Editing you get &#038; = &#038;, which is certainly true but not what youÂ meant.</p>
<p>You think, wellÂ it&#8217;s obvious, I should have used that HTML trick in the first place.Â Do you remember that trick, don&#8217;t you?Â You have to escape the ampersandÂ twice: it works in a plain HTML file.Â You think that the WordPress editor should have done it by itself: it&#8217;s simple enough! But you want things done, you&#8217;re not interested inÂ polemical discussions with your beloved blogging tool.Â So you write &#038; = &amp;amp;amp; andÂ go for another SaCE roundtrip and &#038; = &amp;amp; shows up.</p>
<p>Wow! You&#8217;ve done it, pal. Time for a reward. Go for a coffee and back soon. You&#8217;re inspired now, not a good ideaÂ to waste too much time.</p>
<p>Just before the last molecules of coffee disappear from your tongue, you want toÂ check that all is OK for a Publish trip, and go back trough your post. Suddenly you see something that makes you feel guilty for a simple coffee, whose taste was still there, just because. You saw it right, it was &#038; = &amp;amp; but now it is &#038; = &#038; again!! How can it be?</p>
<p>Soon you&#8217;ll discover that that old trick is useless. It only delayed the problem twice. Yes, each time you Save your post, an &amp;amp; of your escaped entity gets unescaped automatically, that is &#038; eats amp;Â up. So &amp;amp;amp; will be &amp;amp; after the first new Save, andÂ &#038; after just the second one. &#038;Â = pacman.</p>
<p>Well, you only lose a couple of battles. You recently installed that new plugin that promised miracles about transclusions, don&#8217;t you? Yeah, Enzymes was its name.</p>
<p>OK, lets add a custom field called &#8216;amp&#8217; with &amp;amp; as its value. Then write &#038; = {[.amp]} and save and continue editing. Try it now, you&#8217;ll see that this solves the issue.</p>
<p>Done? Isn&#8217;t it wonderful?</p>
<p>What? What are you saying? It doen&#8217;t work?!?! My Enzymes is bullsheet? Well, I&#8217;m sorry. I put many hours of my life in it, and it&#8217;s a bit ungrateful on your side, considering that I didn&#8217;t charge you a dime!</p>
<p>Are you sure you did exactlyÂ what I said? Please check again. Have you found the problem? Yes, that is the problem. The pacman effect strikes back! The &#038; in your &#8216;amp&#8217; custom field ate its &#8216;amp;&#8217; up.</p>
<p>Ehi man, stop joking now! Tell me the solution please, I&#8217;m exhausted!</p>
<p>The solution is:</p>
<blockquote><p>add a custom field called &#8216;entity&#8217; with &#8216;echo htmlentities( htmlentities( $this->substrate ) );&#8217; as its value (without quotes). Then write &#038; = {[.entity(.amp)]}</p></blockquote>
<p>Remember this post pal! You&#8217;re going to use it over and over: {[123.entity(123.amp)]}, if the ID of your post is 123.</p>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/entity-enzyme-or-the-pacman-effect-strikes-back/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Chili &amp; Enzymes</title>
		<link>http://noteslog.com/post/chili-enzymes/</link>
		<comments>http://noteslog.com/post/chili-enzymes/#comments</comments>
		<pubDate>Wed, 08 Nov 2006 02:01:32 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[Chili]]></category>
		<category><![CDATA[Enzymes]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://noteslog.com/?p=81</guid>
		<description><![CDATA[UPDATE (2008-03-20): There is a new post about Chili &#38; Enzymes. Thanks to their new versions, it&#8217;s now much easier to config WordPress highlighting than described here. If you post many code snippets, then Chili and Enzymes can work together for making your life simpler.Here is my proposed configuration: 1. Install Enzymes Download the latest [...]]]></description>
			<content:encoded><![CDATA[<p><em>UPDATE (2008-03-20): There is a new post about <a href="http://noteslog.com/post/how-to-highlight-code-in-wordpress/">Chili &amp; Enzymes</a>. Thanks to their new versions, it&#8217;s now much easier to config WordPress highlighting than described here.</em></p>
<p>If you post many code snippets, then Chili and Enzymes can work together for making your life simpler.Here is my proposed configuration:</p>
<p><strong>1. Install Enzymes</strong><br />
Download the <a href="/?cat=9">latest version</a> to your computer, upload it to your server, in the &#8216;plugins&#8217; directory under &#8216;/wp-content&#8217;, and activate it. No configuration needed.</p>
<p><strong>2. Upload jQuery and Chili<br />
</strong>For this configuration I&#8217;m going to put the file &#8216;jquery-1.0.3.pack.js&#8217; in a &#8216;jquery&#8217; directory under the &#8216;/wp-content&#8217; directory, and the file &#8216;chili-1.1.pack.js&#8217; in a &#8216;chili&#8217; directory under the &#8216;jquery&#8217; directory. In the &#8216;chili&#8217; directory I&#8217;ll put also any recipes and stylesheets I&#8217;ll need.<br />
I recommend to upload and setup at least one of the examples provided with Chili. It&#8217;ll be useful for proving that Chili is properly configured (bypassing WordPress).</p>
<p><strong>3. Upload an E</strong><strong>nzymes template for each language you&#8217;ll use</strong><br />
In fact there are many valid alternatives, but I think that this one is pretty simple and you can eventually expand on it. Here is the template I&#8217;m going to use for JavaScript snippets: <pre class="chili-<?php 
	$tmp = preg_split( '/[\r\n]+/', $this->result );
	if( count( $tmp ) > 28 ) echo 'clip';
	else echo 'all'; 
?>"><code class="javascript"><?php 
	echo htmlentities( $this->result ); 
?></code></pre>Note that the template decides the style of the &#8216;pre&#8217; tag and that the result is automatically escaped. Anyway this is still a naive template, which is not suitable for javascript snippets mixed into html snippets. Remember that the base directory for Enzymes templates is &#8216;wp-content&#8217;.</p>
<p><strong>4. Add style settings to the stylesheet of your current WordPress theme</strong><br />
You should provide only general format for the tags you are going to use for wrapping your code snippets. For example, I&#8217;m going to use a &#8216;pre&#8217; tag wrapped around the &#8216;code&#8217; tag. In the style.css file, I&#8217;ll add these definitions: pre.chili-all {
	color: #333333; 
	background-color: #f4f4f4; 
	font-size: 9pt; 
	line-height: 120%;
	width: 450px; 
	overflow: auto; 
	}

pre.chili-clip {
	color: #333333; 
	background-color: #f4f4f4; 
	font-size: 9pt; 
	line-height: 150%;
	width: 450px; 
	height: 450px; 
	overflow: auto; 
	}

pre.chili-all code, pre.chili-clip code {
	font-size: 9pt; 
	line-height: 150%;
	}As you see, they are very similar: chili-all adjust the height of the box to the length of the content; chili-clip fixes the height to a maximum.</p>
<p><strong>5. Edit the header.php file of your current WordPress theme</strong><br />
This is to enable support for Chili in each HTML page of the blog. It&#8217;s just three script elements: two for loading jQuery and Chili, and one for configuring Chili.</p>
<p>The following two items must appear in the &#8216;head&#8217; section, maybe just before the closing tag. <script type="text/javascript" src="<?php 
	bloginfo('siteurl'); 
?>/wp-content/jquery/jquery-1.0.3.pack.js"></script>
<script type="text/javascript" src="<?php 
	bloginfo('siteurl'); 
?>/wp-content/jquery/chili/chili-1.1.js"></script>The following two items must appear in the &#8216;body&#8217; section, maybe just after the opening tag. <script>
ChiliBook.recipeFolder = "<?php 
	bloginfo('siteurl'); 
?>/wp-content/jquery/chili/";
ChiliBook.stylesheetFolder = "<?php 
	bloginfo('siteurl'); 
?>/wp-content/jquery/chili/";
</script></p>
<p><strong>6. Done, now test the configuration</strong></p>
<ol>
<li>Create a new post titled &#8220;Testing Enzymes &amp; Chili&#8221;. Hit &#8216;Save and Continue Editing&#8217;</li>
<li>Add a custom field with a Key &#8220;js-snippet&#8221; and a Value &#8220;document.writeln( "Hello World!" );&#8221;</li>
<li>Add this Enzymes statement &#8220;{[.js-snippet /enzymes/chili-js.php]}&#8221; into the post area</li>
<li>Hit &#8216;Publish&#8217; and then &#8216;View site&#8217;</li>
</ol>
<p>If it looks like this document.writeln( "Hello World!" ); then all is fine. Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/chili-enzymes/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
