<?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>Compdigitec Labs &#187; (X)HTML</title>
	<atom:link href="http://www.compdigitec.com/labs/category/xhtml/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.compdigitec.com/labs</link>
	<description>The place for interesting things</description>
	<lastBuildDate>Thu, 09 Feb 2012 03:08:56 +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>Creating jQuery UI Tabs</title>
		<link>http://www.compdigitec.com/labs/2011/08/21/creating-jquery-ui-tabs/</link>
		<comments>http://www.compdigitec.com/labs/2011/08/21/creating-jquery-ui-tabs/#comments</comments>
		<pubDate>Sun, 21 Aug 2011 12:23:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[(X)HTML]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[tabs]]></category>
		<category><![CDATA[ui tabs]]></category>

		<guid isPermaLink="false">http://www.compdigitec.com/labs/?p=226</guid>
		<description><![CDATA[jQuery UI Tabs are an easy way to make tabs in your web applications or web sites easily with less code. Consider the following tab structure: To turn this into a fully featured functioning tab system, all one has to execute in the &#60;head&#62; is this provided you have included jQuery and jQuery UI with [...]]]></description>
			<content:encoded><![CDATA[<p><a title="jQuery docs" href="http://docs.jquery.com/UI/Tabs">jQuery UI Tabs</a> are an easy way to make tabs in your web applications or web sites easily with less code. Consider the following tab structure:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;div id=&quot;tabgroup&quot;&gt;
	&lt;ul&gt;
		&lt;li&gt;&lt;a href=&quot;#tab1&quot;&gt;Tab 1&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;#tab2&quot;&gt;Tab 2&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;#tab3&quot;&gt;More Tabs&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;
	&lt;div id=&quot;tab1&quot;&gt;Hello&lt;/div&gt;
	&lt;div id=&quot;tab2&quot;&gt;World&lt;/div&gt;
	&lt;div id=&quot;tab3&quot;&gt;from jQuery UI Tabs&lt;/div&gt;
&lt;/div&gt;
</pre>
<p>To turn this into a fully featured functioning tab system, all one has to execute in the &lt;head&gt; is this provided you have included jQuery and jQuery UI with any CSS in your &lt;head&gt; (default CSS can be included like such: <strong>&lt;link rel=&#8221;stylesheet&#8221; type=&#8221;text/css&#8221; href=&#8221;http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/themes/ui-lightness/jquery-ui.css&#8221; /&gt;</strong>):</p>
<pre class="brush: jscript; title: ; notranslate">
jQuery(document).ready(function() {
	jQuery(&quot;#tabgroup&quot;).tabs();
});
</pre>
<p><a href="http://www.compdigitec.com/labs/wp-content/uploads/2011/08/jquerytabs.png"><img class="aligncenter size-full wp-image-227" title="jQuery UI Tabs" src="http://www.compdigitec.com/labs/wp-content/uploads/2011/08/jquerytabs.png" alt="" width="356" height="144" /></a></p>
<p>This tab structure also degrades reasonably without JavaScript - one is able to view the contents of all of the tabs and the anchor links are usable - unlike some other tab techniques.</p>]]></content:encoded>
			<wfw:commentRss>http://www.compdigitec.com/labs/2011/08/21/creating-jquery-ui-tabs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing &#8220;Error: window.location.refresh is not a function&#8221;</title>
		<link>http://www.compdigitec.com/labs/2010/07/23/fixing-error-window-location-refresh-is-not-a-function/</link>
		<comments>http://www.compdigitec.com/labs/2010/07/23/fixing-error-window-location-refresh-is-not-a-function/#comments</comments>
		<pubDate>Fri, 23 Jul 2010 23:06:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[(X)HTML]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[refresh]]></category>

		<guid isPermaLink="false">http://www.compdigitec.com/labs/?p=181</guid>
		<description><![CDATA[If when you try to refresh the page using Javascript back-end and instead of having the page refresh like you want it to refresh, instead it bounces back into your Javascript Console with a cryptic error that reads &#8220;Error: window.location.refresh is not a function&#8220;. This can be very puzzling, especially if you are not a [...]]]></description>
			<content:encoded><![CDATA[<p>If when you try to refresh the page using Javascript back-end and instead of having the page refresh like you want it to refresh, instead it bounces back into your Javascript Console with a cryptic error that reads &#8220;<strong>Error: window.location.refresh is not a function</strong>&#8220;. This can be very puzzling, especially if you are not a regular JavaScript programmer, so one can <a href="http://msdn.microsoft.com/en-us/library/ms536691(VS.85).aspx">look into the documentation</a>:</p>
<blockquote><p>object.reload( [bReloadSource])</p>
<p>Reloads the current page</p></blockquote>
<p>There&#8217;s just one small problem - it&#8217;s actually object.<strong>reload</strong>, <em><strong>not</strong></em> object.<strong>refresh!</strong> Some poor quality websites (or popular websites which make mistakes) accidently specify location.refresh instead of location.reload. So instead of calling location.refresh(), one should call the following to refresh the page:</p>
<pre class="brush: jscript; title: ; notranslate">window.location.reload();</pre>]]></content:encoded>
			<wfw:commentRss>http://www.compdigitec.com/labs/2010/07/23/fixing-error-window-location-refresh-is-not-a-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XHTML-compliant way to embed Macromedia Flash</title>
		<link>http://www.compdigitec.com/labs/2010/04/30/xhtml-compliant-way-to-embed-macromedia-flash/</link>
		<comments>http://www.compdigitec.com/labs/2010/04/30/xhtml-compliant-way-to-embed-macromedia-flash/#comments</comments>
		<pubDate>Fri, 30 Apr 2010 22:05:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[(X)HTML]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[adobe flash]]></category>
		<category><![CDATA[embed]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[html 5]]></category>
		<category><![CDATA[object]]></category>
		<category><![CDATA[w3c]]></category>
		<category><![CDATA[xhtml 1.0]]></category>

		<guid isPermaLink="false">http://www.compdigitec.com/labs/?p=165</guid>
		<description><![CDATA[For many years, people have been using complicated, ugly ways to forcibly embed their Macromedia Flash content into their webpages. There have been several ways, usually using the non-standard &#60;embed&#62; element or other fancy IE-only &#60;object&#62; hacks. But now, we have a safe, bug-free, validator-safe way to embed Flash that passes the HTML 5 and [...]]]></description>
			<content:encoded><![CDATA[<p>For many years, people have been using complicated, ugly ways to forcibly embed their Macromedia Flash content into their webpages. There have been several ways, usually using the non-standard &lt;embed&gt; element or other fancy IE-only &lt;object&gt; hacks. But now, we have a safe, bug-free, validator-safe way to embed Flash that passes the HTML 5 and XHTML 1.0 standards.</p>
<p>Presenting&#8230;</p>
<pre class="brush: xml; title: ; notranslate">&lt;object type=&quot;application/x-shockwave-flash&quot; data=&quot;replace_this.swf&quot; width=&quot;720&quot; height=&quot;540&quot;&gt;
    &lt;param name=&quot;movie&quot; value=&quot;replace_this.swf&quot; /&gt;
&lt;/object&gt;
</pre>]]></content:encoded>
			<wfw:commentRss>http://www.compdigitec.com/labs/2010/04/30/xhtml-compliant-way-to-embed-macromedia-flash/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Free and open source XML beautifers to format XML</title>
		<link>http://www.compdigitec.com/labs/2009/12/26/free-and-open-source-xml-beautifers-to-format-xml/</link>
		<comments>http://www.compdigitec.com/labs/2009/12/26/free-and-open-source-xml-beautifers-to-format-xml/#comments</comments>
		<pubDate>Sat, 26 Dec 2009 14:07:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[(X)HTML]]></category>
		<category><![CDATA[HTTP (Internet)]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[free and open source]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[xml beautifier]]></category>
		<category><![CDATA[xml code formatting]]></category>
		<category><![CDATA[xml formatting]]></category>

		<guid isPermaLink="false">http://www.compdigitec.com/labs/?p=149</guid>
		<description><![CDATA[XML is a great format for storing data, but an improperly-formatted XML file (e.g. whole file on one line, unusual breaking, improper line wrap, etc) can be just as difficult to read as a binary blob. In order to make &#8220;blob&#8221; XML readable, here are some tools you can use to format XML so it&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>XML is a great format for storing data, but an improperly-formatted XML file (e.g. whole file on one line, unusual breaking, improper line wrap, etc) can be just as difficult to read as a binary blob. In order to make &#8220;blob&#8221; XML readable, here are some tools you can use to format XML so it&#8217;s readable.</p>
<ul>
<li><a href="http://jyro.blogspot.com/2009/08/makeshift-xml-beautifier-in-python.html"><strong>A makeshift Python beautifier</strong></a> - A simple XML formattor written in Python, this formattor formats XML and actually works. Unfortunately, it formats &lt;element&gt;value&lt;/element&gt; into
<pre class="brush: xml; title: ; notranslate">&lt;element&gt;
    value
&lt;/element&gt;</pre>
<p>Which can actually decrease readability, especially if you have lots of short elements.</li>
<li><a href="http://tidy.sourceforge.net/"><strong>HTML Tidy</strong></a> - Official HTML/XHTML formattor endorsed by the World Wide Web Consortorium. However the XML it formatted refused to contain indents, even after enabling all indenting and formatting options. It formatted &lt;tag1&gt;&lt;tag2&gt;&lt;tag3&gt;xyz&lt;/tag3&gt;&lt;/tag2&gt;&lt;/tag1&gt; into
<pre class="brush: xml; title: ; notranslate">&lt;tag1&gt;
&lt;tag2&gt;
&lt;tag3&gt;xyz&lt;/tag3&gt;
&lt;/tag2&gt;
&lt;/tag1&gt;</pre>
<p>This is not much good since indents are generally required in human readable XML.</li>
<li><a href="http://www.thedeveloperday.com/xml-beautifier-tool/"><strong>PHP XML beautifier</strong></a> - Small PHP based XML beautifier. The only one that actually worked properly and formatted readable XML. Formatted &lt;tag1&gt;&lt;tag2&gt;&lt;tag3&gt;xyz&lt;/tag3&gt;&lt;/tag2&gt;&lt;/tag1&gt; into
<pre class="brush: xml; title: ; notranslate">&lt;tag1&gt;
    &lt;tag2&gt;
        &lt;tag3&gt;xyz&lt;/tag3&gt;
    &lt;/tag2&gt;
&lt;/tag1&gt;</pre>
<p>Which is the expected result. For more consistency, you might want to change (in BeautyXML.class.php)</p>
<pre class="brush: php; title: ; notranslate">var $how_to_ident = &quot;    &quot;; // you can user also \t or more/less spaces</pre>
<p>to</p>
<pre class="brush: php; title: ; notranslate">var $how_to_ident = &quot;\t&quot;; // you can user also \t or more/less spaces</pre>
<p>to use tabs instead of spaces to save file space.</li>
</ul>
<p>If you found this article helpful or interesting, please help Compdigitec spread the word. Don’t forget to <a title="Subscribe to Compdigitec Labs" href="/labs/feed/">subscribe to Compdigitec Labs</a> for more interesting articles!</p>]]></content:encoded>
			<wfw:commentRss>http://www.compdigitec.com/labs/2009/12/26/free-and-open-source-xml-beautifers-to-format-xml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Disable WordPress conversion of double-dashes in posts</title>
		<link>http://www.compdigitec.com/labs/2009/07/24/disable-wordpress-conversion-of-double-dashes-in-posts/</link>
		<comments>http://www.compdigitec.com/labs/2009/07/24/disable-wordpress-conversion-of-double-dashes-in-posts/#comments</comments>
		<pubDate>Sat, 25 Jul 2009 00:50:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[(X)HTML]]></category>
		<category><![CDATA[HTTP (Internet)]]></category>
		<category><![CDATA[conversion]]></category>
		<category><![CDATA[disable]]></category>
		<category><![CDATA[double-dash]]></category>
		<category><![CDATA[patch]]></category>
		<category><![CDATA[posts]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.compdigitec.com/labs/?p=117</guid>
		<description><![CDATA[Update (2012-02-03): Updated for WordPress 3.3.1. Update (2011-08-21): Updated for WordPress 3.2.1. Update (2009-08-16): Updated for WordPress 2.8.3. If you use WordPress (like this blog and many hundreds and thousands of blogs) for your blogging engine and you attempt to post code or programming related posts, you may find that WordPress will mess up your [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update (2012-02-03): </strong> Updated for WordPress 3.3.1.</p>
<p><strong>Update (2011-08-21):</strong> Updated for WordPress 3.2.1.</p>
<p><strong>Update (2009-08-16): </strong>Updated for WordPress 2.8.3.</p>
<p>If you use WordPress (like this blog and many hundreds and thousands of blogs) for your blogging engine and you attempt to post code or programming related posts, you may find that <a href="http://www.compdigitec.com/labs/2009/05/15/disable-annoying-update-manager-behaviour-in-ubuntu/comment-page-1/#comment-4381">WordPress will mess up your code</a>. This was pointed out to us by a commenter on the aforementioned page. Out of the side, the <a href="http://www.tech-recipes.com/rx/1865/wordpress_stop_replacing_double_dash_em_dash/" rel="nofollow">guide at Tech-Recepies</a> <strong>will <em>not</em> work</strong> as the mentioned line of code no longer exists in WordPress.</p>
<p>This guide has been tested with WordPress 2.7.1, WordPress 2.8.3 and WordPress 3.3.1.</p>
<p><strong>WordPress 3.3.1</strong><br />
Apply this <a href="/labs/files/formatting331.diff">diff</a> to wp-includes/formatting.php like so:</p>
<pre class="brush: bash; title: ; notranslate">patch formatting.php formatting.diff</pre>
<p>Manual patching: replace lines 56 and 57 of &#8220;wp-includes/formatting.php&#8221; with these two lines:</p>
<pre class="brush: php; title: ; notranslate">
		$static_characters = array_merge( array(/*'---', ' -- ', '--', ' - ', 'xn&amp;#8211;',*/ '...', '``', '\'\'', ' (tm)'), $cockney );
		$static_replacements = array_merge( array(/*$em_dash, ' ' . $em_dash . ' ', $en_dash, ' ' . $en_dash . ' ', 'xn--',*/ '&amp;#8230;', $opening_quote, $closing_quote, ' &amp;#8482;'), $cockneyreplace );
</pre>
<p><strong>WordPress 3.2.1</strong><br />
You can apply this <a href="/labs/files/formatting.diff">diff</a> to wp-includes/formatting.php like so:</p>
<pre class="brush: bash; title: ; notranslate">patch formatting.php formatting.diff</pre>
<p>Or you can patch it manually with the following directions:</p>
<ol>
<li>Download <strong><em>&lt;blog path here&gt;</em></strong>/wp-includes/formatting.php from your webserver (using something like FTP or SSH). Don&#8217;t navigate to the page and try to use &#8220;Save Page As&#8221;, it won&#8217;t work.</li>
<li>Open formatting.php with a text editor, preferably with the ability to navigate to specific lines (<a href="/labs/2008/08/28/geany-the-ultimate-ide-for-programming/">such as Geany</a>, which also displays the line numbers beside each line).</li>
<li>Go to line 52/53 and find this:</li>
<li>
<pre class="brush: php; title: ; notranslate">
$static_characters = array_merge(array('---', ' -- ', '--', ' - ', 'xn–', '...', '``', '\'\'', ' (tm)'), $cockney);
$static_replacements = array_merge(array('—', ' — ', '–', ' – ', 'xn--', '…', $opening_quote, $closing_quote, ' ™'), $cockneyreplace);
</pre>
</li>
<li>Replace it with this:
<pre class="brush: php; title: ; notranslate">
$static_characters = array_merge(array(/*'---', ' -- ', '--', ' - ', 'xn–',*/ '...', '``', '\'\'', ' (tm)'), $cockney);
$static_replacements = array_merge(array(/*'—', ' — ', '–', ' – ', 'xn--',*/ '…', $opening_quote, $closing_quote, ' ™'), $cockneyreplace);
</pre>
</li>
<li>Save and re-upload to web server.</li>
</ol>
<p><strong>Instructions (2.x)</strong></p>
<ol>
<li>Download <strong><em>&lt;blog path here&gt;</em></strong>/wp-includes/formatting.php from your webserver (using something like FTP or SSH). Don&#8217;t navigate to the page and try to use &#8220;Save Page As&#8221;, it won&#8217;t work.</li>
<li>Open formatting.php with a text editor, preferably with the ability to navigate to specific lines (<a href="/labs/2008/08/28/geany-the-ultimate-ide-for-programming/">such as Geany</a>, which also displays the line numbers beside each line).</li>
<li>(<em>2.7.1 only</em>)</li>
<li>Navigate/browse to line 47/48 and find the following code:</li>
<li><span style="color: #0000bb;"> $static_characters </span><span style="color: #007700;">= </span><span style="color: #0000bb;">array_merge</span><span style="color: #007700;">(array(</span><span style="color: #dd0000;">&#8216;---&#8217;</span><span style="color: #007700;">, </span><span style="color: #dd0000;">&#8216; -- &#8217;</span><span style="color: #007700;">, </span><span style="color: #dd0000;">&#8216;--&#8217;</span><span style="color: #007700;">, </span><span style="color: #dd0000;">&#8216;xn&amp;#8211;&#8217;</span><span style="color: #007700;">,</span><span style="color: #dd0000;">&#8216;&#8230;&#8217;</span><span style="color: #007700;">, </span><span style="color: #dd0000;">&#8216;&#8220;&#8217;</span><span style="color: #007700;">, </span><span style="color: #dd0000;">&#8216;\&#8217;s&#8217;</span><span style="color: #007700;">, </span><span style="color: #dd0000;">&#8216;\&#8217;\&#8221;</span><span style="color: #007700;">, </span><span style="color: #dd0000;">&#8216; (tm)&#8217;</span><span style="color: #007700;">), </span><span style="color: #0000bb;">$cockney</span><span style="color: #007700;">);</span><span style="color: #007700;"><br />
</span><span style="color: #0000bb;">$static_replacements </span><span style="color: #007700;">= </span><span style="color: #0000bb;">array_merge</span><span style="color: #007700;">(array(</span><span style="color: #dd0000;">&#8216;&amp;#8212;&#8217;</span><span style="color: #007700;">, </span><span style="color: #dd0000;">&#8216; &amp;#8212; &#8217;</span><span style="color: #007700;">, </span><span style="color: #dd0000;">&#8216;&amp;#8211;&#8217;</span><span style="color: #007700;">, </span><span style="color: #dd0000;">&#8216;xn--&#8217;</span><span style="color: #007700;">,</span><span style="color: #dd0000;">&#8216;&amp;#8230;&#8217;</span><span style="color: #007700;">, </span><span style="color: #dd0000;">&#8216;&amp;#8220;&#8217;</span><span style="color: #007700;">, </span><span style="color: #dd0000;">&#8216;&amp;#8217;s&#8217;</span><span style="color: #007700;">, </span><span style="color: #dd0000;">&#8216;&amp;#8221;&#8217;</span><span style="color: #007700;">, </span><span style="color: #dd0000;">&#8216; &amp;#8482;&#8217;</span><span style="color: #007700;">), </span><span style="color: #0000bb;">$cockneyreplace</span><span style="color: #007700;">);</span></li>
<li>(<em>2.8.3 only</em>)</li>
<li>Browse to line 55/56 and find the following code:</li>
<li><code><span style="color: #000000;"><br />
<span style="color: #0000bb;">$static_characters </span><span style="color: #007700;">= </span><span style="color: #0000bb;">array_merge</span><span style="color: #007700;">(array(</span><span style="color: #dd0000;">'---'</span><span style="color: #007700;">, </span><span style="color: #dd0000;">' -- '</span><span style="color: #007700;">, </span><span style="color: #dd0000;">'--'</span><span style="color: #007700;">, </span><span style="color: #dd0000;">' - '</span><span style="color: #007700;">, </span><span style="color: #dd0000;">'xn&amp;#8211;'</span><span style="color: #007700;">, </span><span style="color: #dd0000;">'...'</span><span style="color: #007700;">, </span><span style="color: #dd0000;">'``'</span><span style="color: #007700;">, </span><span style="color: #dd0000;">'\'s'</span><span style="color: #007700;">, </span><span style="color: #dd0000;">'\'\''</span><span style="color: #007700;">, </span><span style="color: #dd0000;">' (tm)'</span><span style="color: #007700;">), </span><span style="color: #0000bb;">$cockney</span><span style="color: #007700;">);<br />
</span><span style="color: #0000bb;">$static_replacements </span><span style="color: #007700;">= </span><span style="color: #0000bb;">array_merge</span><span style="color: #007700;">(array(</span><span style="color: #dd0000;">'&amp;#8212;'</span><span style="color: #007700;">, </span><span style="color: #dd0000;">' &amp;#8212; '</span><span style="color: #007700;">, </span><span style="color: #dd0000;">'&amp;#8211;'</span><span style="color: #007700;">, </span><span style="color: #dd0000;">' &amp;#8211; '</span><span style="color: #007700;">, </span><span style="color: #dd0000;">'xn--'</span><span style="color: #007700;">, </span><span style="color: #dd0000;">'&amp;#8230;'</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$opening_quote</span><span style="color: #007700;">, </span><span style="color: #dd0000;">'&amp;#8217;s'</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$closing_quote</span><span style="color: #007700;">, </span><span style="color: #dd0000;">' &amp;#8482;'</span><span style="color: #007700;">), </span><span style="color: #0000bb;">$cockneyreplace</span><span style="color: #007700;">);<br />
</span><br />
</span><br />
</code></li>
<li>(<em>end version specific instructions</em>)</li>
<li>Once you have found the aforementioned lines of code, comment out the first four items in each array. In short, replace the above two lines with:</li>
<li>(<em>2.7.1 only</em>)</li>
<li><span style="color: #0000bb;"> $static_characters </span><span style="color: #007700;">= </span><span style="color: #0000bb;">array_merge</span><span style="color: #007700;">(array(</span><span style="color: #ff8000;">/*&#8217;---&#8217;, &#8217; -- &#8217;, &#8217;--&#8217;, &#8217;xn&amp;#8211;&#8217;,*/</span><span style="color: #dd0000;">&#8216;&#8230;&#8217;</span><span style="color: #007700;">, </span><span style="color: #dd0000;">&#8216;&#8220;&#8217;</span><span style="color: #007700;">, </span><span style="color: #dd0000;">&#8216;\&#8217;s&#8217;</span><span style="color: #007700;">, </span><span style="color: #dd0000;">&#8216;\&#8217;\&#8221;</span><span style="color: #007700;">, </span><span style="color: #dd0000;">&#8216; (tm)&#8217;</span><span style="color: #007700;">), </span><span style="color: #0000bb;">$cockney</span><span style="color: #007700;">);</span><span style="color: #007700;"><br />
</span><span style="color: #0000bb;">$static_replacements </span><span style="color: #007700;">= </span><span style="color: #0000bb;">array_merge</span><span style="color: #007700;">(array(</span><span style="color: #ff8000;">/*&#8217;&amp;#8212;&#8217;, &#8217; &amp;#8212; &#8217;, &#8217;&amp;#8211;&#8217;, &#8217;xn--&#8217;,*/</span><span style="color: #dd0000;">&#8216;&amp;#8230;&#8217;</span><span style="color: #007700;">, </span><span style="color: #dd0000;">&#8216;&amp;#8220;&#8217;</span><span style="color: #007700;">, </span><span style="color: #dd0000;">&#8216;&amp;#8217;s&#8217;</span><span style="color: #007700;">, </span><span style="color: #dd0000;">&#8216;&amp;#8221;&#8217;</span><span style="color: #007700;">, </span><span style="color: #dd0000;">&#8216; &amp;#8482;&#8217;</span><span style="color: #007700;">), </span><span style="color: #0000bb;">$cockneyreplace</span><span style="color: #007700;">);</span></li>
<li>（<em>2.8.3 only</em>）</li>
<li><code><span style="color: #000000;"><br />
<span style="color: #0000bb;">$static_characters </span><span style="color: #007700;">= </span><span style="color: #0000bb;">array_merge</span><span style="color: #007700;">(array(</span><span style="color: #ff8000;">/*'---', ' -- ', '--', ' - ', 'xn&amp;#8211;',*/ </span><span style="color: #dd0000;">'...'</span><span style="color: #007700;">, </span><span style="color: #dd0000;">'``'</span><span style="color: #007700;">, </span><span style="color: #dd0000;">'\'s'</span><span style="color: #007700;">, </span><span style="color: #dd0000;">'\'\''</span><span style="color: #007700;">, </span><span style="color: #dd0000;">' (tm)'</span><span style="color: #007700;">), </span><span style="color: #0000bb;">$cockney</span><span style="color: #007700;">);<br />
</span><span style="color: #0000bb;">$static_replacements </span><span style="color: #007700;">= </span><span style="color: #0000bb;">array_merge</span><span style="color: #007700;">(array(</span><span style="color: #ff8000;">/*'&amp;#8212;', ' &amp;#8212; ', '&amp;#8211;', ' &amp;#8211; ', 'xn--',*/ </span><span style="color: #dd0000;">'&amp;#8230;'</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$opening_quote</span><span style="color: #007700;">, </span><span style="color: #dd0000;">'&amp;#8217;s'</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$closing_quote</span><span style="color: #007700;">, </span><span style="color: #dd0000;">' &amp;#8482;'</span><span style="color: #007700;">), </span><span style="color: #0000bb;">$cockneyreplace</span><span style="color: #007700;">);<br />
</span><br />
</span><br />
</code></li>
<li>(<em>end version specific instructions</em>)</li>
<li>Save the file and re-upload to take effect.</li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://www.compdigitec.com/labs/2009/07/24/disable-wordpress-conversion-of-double-dashes-in-posts/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Using (X)HTML entities in plain XML files</title>
		<link>http://www.compdigitec.com/labs/2009/07/14/using-xhtml-entities-in-plain-xml-files/</link>
		<comments>http://www.compdigitec.com/labs/2009/07/14/using-xhtml-entities-in-plain-xml-files/#comments</comments>
		<pubDate>Tue, 14 Jul 2009 21:15:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[(X)HTML]]></category>
		<category><![CDATA[accents]]></category>
		<category><![CDATA[encoding]]></category>
		<category><![CDATA[entities]]></category>
		<category><![CDATA[entitiy does not exist]]></category>
		<category><![CDATA[entity]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.compdigitec.com/labs/?p=111</guid>
		<description><![CDATA[Update (2009-07-28): Here is a place that you can find accents for English characters. If you try to use non-ASCII characters (e.g. accents) in directly in a Windows-1252 (ISO-8859-1) encoded web page directly without converting/transforming them into an entity, the web browser may get confused when the header of the web page is sent wrong [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update (2009-07-28): </strong>Here is a place that you can find <a href="http://tlt.its.psu.edu/suggestions/international/web/codehtml.html">accents for English characters</a>.</p>
<p>If you try to use non-ASCII characters (e.g. <a href="http://www.thesauruslex.com/typo/eng/enghtml.htm">accents</a>) in directly in a Windows-1252 (ISO-8859-1) encoded web page directly without converting/transforming them into an entity, the web browser may get confused when the header of the web page is sent wrong or is misunderstood, resulting in garbled accents and even possibly <a href="http://en.wikipedia.org/wiki/Mojibake">mojibake</a>.</p>
<p>The correct way to embed those into a web page are to use the corresponding (X)HTML entities such as <strong>&amp;ecirc;</strong> for the <strong>ê</strong> accent. But if you try to load a string from a XML file into a web page (as many PHP scripts do nowadays), you will encounter a nasty error informing you that the entity was not defined (e.g. <strong>parser error : Entity &#8216;eacute&#8217; not defined</strong>). To remedy this, in the XML file instead of the direct entity replace the ampersand (&amp;) in the entity with its entity version. This may sound confusing at first but after a while it starts to make sense.</p>
<blockquote>
<ul>
<li>XML file display = &amp;amp;ecirc;</li>
<li>HTML source display = &amp;ecirc;</li>
<li>Browser display = ê</li>
</ul>
</blockquote>
<p>If you found this article helpful or useful, please help Compdigitec spread the word. Don’t forget to <a href="/labs/feed/">subscribe to Compdigitec Labs</a> for more useful or interesting articles!</p>]]></content:encoded>
			<wfw:commentRss>http://www.compdigitec.com/labs/2009/07/14/using-xhtml-entities-in-plain-xml-files/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Removing WordPress post revisions feature</title>
		<link>http://www.compdigitec.com/labs/2009/03/13/removing-wordpress-post-revisions-feature/</link>
		<comments>http://www.compdigitec.com/labs/2009/03/13/removing-wordpress-post-revisions-feature/#comments</comments>
		<pubDate>Sat, 14 Mar 2009 03:03:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[(X)HTML]]></category>
		<category><![CDATA[HTTP (Internet)]]></category>
		<category><![CDATA[annoying]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[buggy]]></category>
		<category><![CDATA[post]]></category>
		<category><![CDATA[post revisions]]></category>
		<category><![CDATA[really annoying]]></category>
		<category><![CDATA[slow]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.compdigitec.com/labs/?p=72</guid>
		<description><![CDATA[WordPress 2.6 and above&#8217;s new feature of post revisions only slows WordPress down and makes it less usable. So here is how to disable post revisions: Open wp-config.php in your wordpress installation directory with a text editor. Add the line &#8220;define('WP_POST_REVISIONS', false);" anywhere in the file in a new line after the &#60;?php header. Save [...]]]></description>
			<content:encoded><![CDATA[<p>WordPress 2.6 and above&#8217;s new feature of post revisions only slows WordPress down and makes it less usable. So here is how to disable post revisions:</p>
<ol>
<li>Open <strong>wp-config.php</strong> in your wordpress installation directory with a text editor.</li>
<li>Add the line &#8220;<code><strong>define('WP_POST_REVISIONS', false);</strong>" anywhere in the file in a new line after the <strong>&lt;?php</strong> header.</code></li>
<li>Save it and upload it to your webserver, overwriting the previous file.</li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://www.compdigitec.com/labs/2009/03/13/removing-wordpress-post-revisions-feature/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple Template Engine - your lightweight templating engine in PHP</title>
		<link>http://www.compdigitec.com/labs/2009/02/02/simple-template-engine-your-lightweight-templating-engine-in-php/</link>
		<comments>http://www.compdigitec.com/labs/2009/02/02/simple-template-engine-your-lightweight-templating-engine-in-php/#comments</comments>
		<pubDate>Tue, 03 Feb 2009 01:30:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[(X)HTML]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[engine]]></category>
		<category><![CDATA[simple template engine]]></category>
		<category><![CDATA[stl]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[templating]]></category>
		<category><![CDATA[tpl]]></category>

		<guid isPermaLink="false">http://www.compdigitec.com/labs/?p=69</guid>
		<description><![CDATA[The Simple Template Engine is a very lightweight template engine to use in PHP if your webhost does not allow you to run something like Smarty. It is simple, lightweight and fast. To parse a file: example.tpl is: &#60;html&#62;&#60;head&#62;&#60;title&#62;{content}&#60;/title&#62;&#60;/head&#62;&#60;body&#62;&#60;h1&#62;{content}&#60;/h1&#62;&#60;/body&#62;&#60;/html&#62; If you found this article useful or helpful, please help Compdigitec spread the word. Don&#8217;t forget [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://www.phpclasses.org/browse/package/3171.html">Simple Template Engine</a> is a very lightweight template engine to use in PHP if your webhost does not allow you to run something like <a rel="nofollow" href="http://smarty.php.net/">Smarty</a>. It is simple, lightweight and fast.</p>
<p>To parse a file:</p>
<pre class="brush: php; title: ; notranslate">&lt;?php

// include simple template engine
include(&quot;tpl.class.php&quot;);

$tpl = new template();

$tpl-&gt;assign(Array('content'=&gt;&quot;Hello World from Simple Template Engine!&quot;));

// If you want to display it directly
$tpl-&gt;display('example.tpl');

// If you want to send it to another function/class for more processing
some_function($tpl-&gt;parse('example.tpl'));

?&gt;</pre>
<p>example.tpl is:</p>
<p>&lt;html&gt;&lt;head&gt;&lt;title&gt;{content}&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;h1&gt;{content}&lt;/h1&gt;&lt;/body&gt;&lt;/html&gt;</p>
<p>If you found this article useful or helpful, please help Compdigitec spread the word. Don&#8217;t forget to <a title="Subscribe to Compdigitec Labs" href="/labs/feed/">subscribe to Compdigitec Labs</a> for more useful and interesting articles!</p>]]></content:encoded>
			<wfw:commentRss>http://www.compdigitec.com/labs/2009/02/02/simple-template-engine-your-lightweight-templating-engine-in-php/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Enabling  and  in MediaWiki</title>
		<link>http://www.compdigitec.com/labs/2008/09/14/enabling-and-in-mediawiki/</link>
		<comments>http://www.compdigitec.com/labs/2008/09/14/enabling-and-in-mediawiki/#comments</comments>
		<pubDate>Sun, 14 Sep 2008 14:06:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[(X)HTML]]></category>
		<category><![CDATA[HTTP (Internet)]]></category>
		<category><![CDATA[cite]]></category>
		<category><![CDATA[mediawiki]]></category>
		<category><![CDATA[ref]]></category>
		<category><![CDATA[refernces]]></category>
		<category><![CDATA[wikipedia]]></category>
		<category><![CDATA[wikipedia-style citations]]></category>

		<guid isPermaLink="false">http://www.compdigitec.com/labs/?p=42</guid>
		<description><![CDATA[If you have a MediaWiki installation and decide to make it Wikipedia-like, you will find that the &#60;ref&#62; tags and the &#60;references /&#62; tags don&#8217;t work like they do in Wikipedia. Below is a screenshot of the citation tags not working: To fix this problem, you need to install the Cite extenstion for MediaWiki. Below [...]]]></description>
			<content:encoded><![CDATA[<p>If you have a MediaWiki installation and decide to make it Wikipedia-like, you will find that the &lt;ref&gt; tags and the &lt;references /&gt; tags don&#8217;t work like they do in Wikipedia. Below is a screenshot of the citation tags not working:<br />
<img style="width: 674px; height: 418px;" title="MediaWiki 1.12 without the Cite extension" src="/images/labs/mediawiki-12-nocite.png" alt="MediaWiki 1.12 without the Cite extension" /></p>
<p>To fix this problem, you need to install the <a rel="nofollow" href="http://www.mediawiki.org/wiki/Extension:Cite/Cite.php">Cite extenstion for MediaWiki</a>. Below is a step-by-step guide to installing the Cite extension:</p>
<ol>
<li>Download the Cite extension - <a href="/labs/files/cite40816.zip">ZIP format</a>, <a href="/labs/files/cite40816.rar">RAR format</a> or <a href="/labs/files/cite40816.7z">7zip format</a>.</li>
<li>Extract it to a temporary location.</li>
<li>Upload the &#8220;Cite&#8221; folder to your extensions folder.</li>
<li>Edit LocalSettings.php and add:
<pre>require_once( $IP.'/extensions/Cite/Cite.php' );</pre>
<p>after the line</p>
<pre>require_once( "$IP/includes/DefaultSettings.php" );</pre>
</li>
<li>Now refresh the page and try again!</li>
</ol>
<p>If you found this article helpful, please help Compdigitec spread the word. Don&#8217;t forget to <a href="/labs/feed/">subscribe</a> to Compdigitec Labs for more interesting articles!</p>]]></content:encoded>
			<wfw:commentRss>http://www.compdigitec.com/labs/2008/09/14/enabling-and-in-mediawiki/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SimpleXML - solution for XML manipulation in PHP</title>
		<link>http://www.compdigitec.com/labs/2008/09/07/simplexml-solution-for-xml-manipulation-in-php/</link>
		<comments>http://www.compdigitec.com/labs/2008/09/07/simplexml-solution-for-xml-manipulation-in-php/#comments</comments>
		<pubDate>Sun, 07 Sep 2008 20:33:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[(X)HTML]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[dom]]></category>
		<category><![CDATA[recurseive]]></category>
		<category><![CDATA[simplexml]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[xml manip]]></category>
		<category><![CDATA[xml manipulation]]></category>
		<category><![CDATA[xml parse]]></category>

		<guid isPermaLink="false">http://www.compdigitec.com/labs/?p=41</guid>
		<description><![CDATA[If you ever do get the need to manipulate (read/write) XML, you could try using the PHP DOM API, but it&#8217;s very difficult to use the DOM. An good extension-less way to access and manipulate XML instead is SimpleXML. It&#8217;s very easy to use compared to DOM and features a easy way to access attributes [...]]]></description>
			<content:encoded><![CDATA[<p>If you ever do get the need to manipulate (read/write) XML, you could try using the PHP <a rel="nofollow" href="http://php.net/dom">DOM API</a>, but it&#8217;s very difficult to use the DOM. An good extension-less way to access and manipulate XML instead is <a href="http://php.net/simplexml" rel="nofollow">SimpleXML</a>. It&#8217;s very easy to use compared to DOM and features a easy way to access attributes and tags in any XML document.</p>
<p><strong>XML file (sample.xml)<br />
</strong>&lt;?xml version=&#8221;1.0&#8243; ?&gt;<br />
&lt;root&gt;&lt;example&gt;This is example number 1&lt;/example&gt;&lt;example&gt;&lt;tag&gt;This is a tag.&lt;/tag&gt;&lt;/example&gt;&lt;/root&gt;</p>
<p><strong>Reading a XML file</strong><code><span style="color: #000000;"><br />
<span style="color: #0000bb;">&lt;?php<br />
</span></span></code>$a <span style="color: #007700;">= new </span><span style="color: #0000bb;">SimpleXMLElement</span><span style="color: #007700;">(</span><span style="color: #0000bb;">file_get_contents</span><span style="color: #007700;">(</span><span style="color: #dd0000;">&#8220;sample.xml&#8221;</span><span style="color: #007700;">));<br />
</span>echo <span style="color: #0000bb;">$a</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">example</span><span style="color: #007700;">[</span><span style="color: #0000bb;">0</span><span style="color: #007700;">];<br />
</span><span style="color: #0000bb;">?&gt;<br />
</span><br />
The example above will read the sample XML file above and will output the contents of the first &lt;example&gt; element.</p>
<p><strong>Writing a XML file</strong></p>
<p>&lt;?php<br />
$a = new SimpleXMLElement(&#8216;&lt;?xml version=&#8221;1.0&#8243; ?&gt;&lt;root&gt;&lt;/root&gt;&#8217;);<br />
for($i = 1; $i &lt;= 9; $i++) {<br />
$a-&gt;addChild(&#8220;element$i&#8221;,&#8221;Hello&#8221;);<br />
}<br />
echo $a-&gt;asXML();<br />
?&gt;</p>
<p>The above example will create the following XML file:</p>
<p>&lt;?xml version=&#8221;1.0&#8243;?&gt;<br />
&lt;root&gt;&lt;element1&gt;Hello&lt;/element1&gt;&lt;element2&gt;Hello&lt;/element2&gt;&lt;element3&gt;Hello&lt;/element3&gt;&lt;element4&gt;Hello&lt;/element4&gt;&lt;element5&gt;Hello&lt;/element5&gt;&lt;element6&gt;Hello&lt;/element6&gt;&lt;element7&gt;Hello&lt;/element7&gt;&lt;element8&gt;Hello&lt;/element8&gt;&lt;element9&gt;Hello&lt;/element9&gt;&lt;/root&gt;</p>
<p>So as you can see, you can very easily manipulate XML with SimpleXML. Don&#8217;t forget to subscribe to Compdigitec Labs for more interesting articles!</p>]]></content:encoded>
			<wfw:commentRss>http://www.compdigitec.com/labs/2008/09/07/simplexml-solution-for-xml-manipulation-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

