<?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>Japh &#187; PHP</title>
	<atom:link href="http://japh.com.au/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://japh.com.au</link>
	<description>Web developer, technologist, innovator. I love the internet.</description>
	<lastBuildDate>Tue, 13 Jul 2010 10:48:15 +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>Custom default Gravatar in WordPress 2.7</title>
		<link>http://japh.com.au/php/custom-default-gravatar-in-wordpress/</link>
		<comments>http://japh.com.au/php/custom-default-gravatar-in-wordpress/#comments</comments>
		<pubDate>Thu, 02 Apr 2009 03:45:06 +0000</pubDate>
		<dc:creator>Japh</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://japh.com.au/?p=124</guid>
		<description><![CDATA[If you&#8217;ve been using WordPress for a little while, and don&#8217;t really much like the default options you have to choose from when a commenter doesn&#8217;t have their own Gravatar, why not make your own?
Make yourself a little square image to use that matches in with your theme, and then insert the following line of [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve been using WordPress for a little while, and don&#8217;t really much like the default options you have to choose from when a commenter doesn&#8217;t have their own Gravatar, why not make your own?</p>
<p>Make yourself a little square image to use that matches in with your theme, and then insert the following line of code:</p>

<div class="wp_codebox"><table><tr id="p1242"><td class="code" id="p124code2"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> get_avatar<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$comment</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">86</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'http://example.com/custom-default-av.png'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p><strong>Note:</strong> you must provide the full absolute URL for your image.</p>
<p>What this line does, is show a Gravatar for the user if they have one, and if not, show your custom one instead. The number &#8220;86&#8243; is the pixel width and height you want the Gravatars to display at.</p>
<p>Remember that this will only work in WordPress 2.7+, or possibly in older versions if you have the Gravatar plugin installed (not tested).</p>
<p><strong>Update:</strong> If you don&#8217;t know what a Gravatar is, check out the comments.  The avatar&#8217;s shown beside each comment are automatically pulled in from Gravatar&#8217;s service, so you upload your avatar once, and it appears everywhere when you comment etc.  Get yourself one here: <a href="http://gravatar.com/">Gravatar</a></p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://japh.com.au/php/custom-default-gravatar-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>First NETTUTS Tutorial Posted!</title>
		<link>http://japh.com.au/general/first-nettuts-tutorial-posted/</link>
		<comments>http://japh.com.au/general/first-nettuts-tutorial-posted/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 10:39:09 +0000</pubDate>
		<dc:creator>Japh</dc:creator>
				<category><![CDATA[General Chatter]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://japheththomson.com/?p=78</guid>
		<description><![CDATA[I wrote my first tutorial for NETTUTS recently and it was published last night.
Title: Create a Slick Flickr Gallery with SimplePie
 Description: I&#8217;ve wanted to write a tutorial for quite some time now, and APIs have always been a particular interest of mine. So with my wife&#8217;s recent foray into photography, I decided a Flickr [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>I wrote my first tutorial for <a title="NETTUTS" href="http://net.tutsplus.com" target="_blank">NETTUTS</a> recently and it was published last night.</p>
<p><strong>Title</strong>: <a title="Create a Slick Flickr Gallery with SimplePie" href="http://net.tutsplus.com/tutorials/php/create-a-slick-flickr-gallery-with-simplepie/">Create a Slick Flickr Gallery with SimplePie</a><br />
<strong> Description</strong>: I&#8217;ve wanted to write a tutorial for quite some time now, and APIs have always been a particular interest of mine. So with my wife&#8217;s recent foray into photography, I decided a Flickr tutorial would be first cab off the rank! Using RSS, Flickr and jQuery all together was pretty fun too.</p>
<p>Check it out!  <img src='http://japh.com.au/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://japh.com.au/general/first-nettuts-tutorial-posted/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Tracking memory usage</title>
		<link>http://japh.com.au/general/tracking-memory-usage/</link>
		<comments>http://japh.com.au/general/tracking-memory-usage/#comments</comments>
		<pubDate>Fri, 06 Feb 2009 12:35:51 +0000</pubDate>
		<dc:creator>Japh</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[General Chatter]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://japheththomson.com/?p=67</guid>
		<description><![CDATA[Recently I received a warning from my host that I was WAY over my memory limit.  I had some long running processes going, and a few cron scripts that altogether were using about 220mb out of my 120mb of allowed memory usage&#8230;  oops!
Anyway, there&#8217;s currently no way from my control panel to see [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>Recently I received a warning from my host that I was WAY over my memory limit.  I had some long running processes going, and a few cron scripts that altogether were using about 220mb out of my 120mb of allowed memory usage&#8230;  oops!</p>
<p>Anyway, there&#8217;s currently no way from my control panel to see how memory I&#8217;m currently using, I have to run a command from a terminal, and certainly no way to tell usage over time.  So, after looking at a thread my hosting provider pointed me to, I decided to have a play with the Google Charts API!<br />
<span id="more-67"></span><br />
This is a pretty rudimentary solution, but it&#8217;s working so far for me.</p>
<p><strong>1. A very simple bash script</strong></p>

<div class="wp_codebox"><table><tr id="p677"><td class="code" id="p67code7"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #c20cb9; font-weight: bold;">ps</span> <span style="color: #660033;">-u</span> username <span style="color: #660033;">-o</span> pid,rss,<span style="color: #7a0874; font-weight: bold;">command</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-e</span> mpm <span style="color: #660033;">-v</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{sum+=$2} END {print &quot;,&quot;, sum}'</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>webroot<span style="color: #000000; font-weight: bold;">/</span>mem<span style="color: #000000; font-weight: bold;">/</span>memdata.csv</pre></td></tr></table></div>

<p>The script basically just outputs the current memory usage at the time of running and appends it to a CSV file.</p>
<p><strong>2. Add the script to the crontab</strong></p>
<p>By running the following command (or one similar), I edit my crontab:</p>

<div class="wp_codebox"><table><tr id="p678"><td class="code" id="p67code8"><pre class="bash" style="font-family:monospace;">crontab <span style="color: #660033;">-e</span></pre></td></tr></table></div>

<p>I then insert this line:</p>

<div class="wp_codebox"><table><tr id="p679"><td class="code" id="p67code9"><pre class="bash" style="font-family:monospace;"><span style="color: #000000;">0</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>full<span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>script<span style="color: #000000; font-weight: bold;">/</span>memlogger</pre></td></tr></table></div>

<p>So now that bash script will be run every hour, on the hour.</p>
<p><strong>3. Writing a PHP script to display a Google Chart</strong></p>

<div class="wp_codebox"><table><tr id="p6710"><td class="code" id="p67code10"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">// Settings</span>
<span style="color: #000088;">$max_mem</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">120</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Your memory limit, in MB</span>
<span style="color: #000088;">$data_file</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'memdata.csv'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$chart_width</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">550</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$chart_height</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">400</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #339933;">&lt;!</span>DOCTYPE html <span style="color: #000000; font-weight: bold;">PUBLIC</span> <span style="color: #0000ff;">&quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;</span> <span style="color: #0000ff;">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>html xmlns<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://www.w3.org/1999/xhtml&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>head<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>meta http<span style="color: #339933;">-</span>equiv<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Content-Type&quot;</span> content<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/html; charset=utf-8&quot;</span> <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;</span>title<span style="color: #339933;">&gt;</span>Memory Usage<span style="color: #339933;">&lt;/</span>title<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>head<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;</span>body<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>h2<span style="color: #339933;">&gt;</span>Memory Usage<span style="color: #339933;">&lt;/</span>h2<span style="color: #339933;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$md</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/file_get_contents"><span style="color: #990000;">file_get_contents</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data_file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$md</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/preg_replace"><span style="color: #990000;">preg_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/(\s+|\n)/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$md</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$md</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/explode"><span style="color: #990000;">explode</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">','</span><span style="color: #339933;">,</span> <span style="color: #000088;">$md</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<a href="http://www.php.net/array_shift"><span style="color: #990000;">array_shift</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$md</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$max</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$min</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$md</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$v</span> <span style="color: #339933;">&gt;</span> <span style="color: #000088;">$max</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$max</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$v</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000088;">$base</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$max</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$base</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$max_mem</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">1024</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> <span style="color: #000088;">$max</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$base</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/round"><span style="color: #990000;">round</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$base</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #339933;">&lt;</span>p<span style="color: #339933;">&gt;&lt;</span>img src<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://chart.apis.google.com/chart?cht=lc&amp;chd=t:&lt;?php echo implode(',', <span style="color: #006699; font-weight: bold;">$md</span>); ?&gt;&amp;chs=&lt;?php echo <span style="color: #006699; font-weight: bold;">$chart_width</span>; ?&gt;x&lt;?php echo <span style="color: #006699; font-weight: bold;">$chart_height</span>; ?&gt;&amp;chxt=y,r&amp;chxr=0,&lt;?php echo <span style="color: #006699; font-weight: bold;">$min</span>; ?&gt;,&lt;?php echo <span style="color: #006699; font-weight: bold;">$max</span>; ?&gt;|1,&lt;?php echo <span style="color: #006699; font-weight: bold;">$min</span>; ?&gt;,&lt;?php echo <span style="color: #006699; font-weight: bold;">$max</span>; ?&gt;&amp;chds=&lt;?php echo <span style="color: #006699; font-weight: bold;">$min</span>; ?&gt;,&lt;?php echo <span style="color: #006699; font-weight: bold;">$max</span>; ?&gt;&amp;chm=r,FF0000,0,&lt;?php echo <span style="color: #006699; font-weight: bold;">$base</span>; ?&gt;,&lt;?php echo <span style="color: #006699; font-weight: bold;">$base</span>+0.005; ?&gt;&quot;</span> <span style="color: #339933;">/&gt;&lt;/</span>p<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>body<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>html<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>This code basically just imports the data into an array, and then works a few things out for proper axis labelling, and away it goes!  It&#8217;s pretty quick and dirty, and could probably have been done nicer&#8230;  maybe I&#8217;ll come back and fix it up some time.</p>
<p>It also uses your memory limit amount to show a red line on the graph if you go over  <img src='http://japh.com.au/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Here&#8217;s the chart using some sample data:<br />
<img src="http://japh.com.au/wp-content/uploads/2009/02/memory-usage-chart-300x245.jpg" alt="Memory Usage Chart" title="Memory Usage Chart" width="300" height="245" class="alignnone size-medium wp-image-75" /></p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://japh.com.au/general/tracking-memory-usage/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>APIs and The Grey Album</title>
		<link>http://japh.com.au/general/apis-and-the-grey-album/</link>
		<comments>http://japh.com.au/general/apis-and-the-grey-album/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 14:05:09 +0000</pubDate>
		<dc:creator>Japh</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[General Chatter]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Flickr]]></category>
		<category><![CDATA[photo album]]></category>

		<guid isPermaLink="false">http://japheththomson.com/?p=43</guid>
		<description><![CDATA[Lately I&#8217;ve been playing around with a few different APIs.  Getting the hang of using them and seeing what they can do.  I&#8217;ve had a brief play with both the Flickr and Twitter APIs, and they&#8217;re both actually very user-friendly yet powerful.
I decided to build a simple photo album script using mostly PHP [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>Lately I&#8217;ve been playing around with a few different APIs.  Getting the hang of using them and seeing what they can do.  I&#8217;ve had a brief play with both the Flickr and Twitter APIs, and they&#8217;re both actually very user-friendly yet powerful.</p>
<p>I decided to build a simple photo album script using mostly PHP and jQuery to do the tricky parts, and the SimplePie library for actually importing the photo stream.  I&#8217;ve called it <a title="The Grey Album" href="http://japheththomson.com/greyalbum/">The Grey Album</a>, and though I probably wouldn&#8217;t call it a complete and comprehensive script, it seems to do the job.  Any feedback is most welcome!</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://japh.com.au/general/apis-and-the-grey-album/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fun with wild-card domain names</title>
		<link>http://japh.com.au/php/fun-with-wild-card-domain-names/</link>
		<comments>http://japh.com.au/php/fun-with-wild-card-domain-names/#comments</comments>
		<pubDate>Tue, 16 Sep 2008 00:25:59 +0000</pubDate>
		<dc:creator>Japh</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[DNS]]></category>

		<guid isPermaLink="false">http://japheththomson.com/2008/09/16/fun-with-wild-card-domain-names/</guid>
		<description><![CDATA[After seeing quite a few websites with dynamic content based on the domain name, I wanted to give it a try to see how difficult it was to achieve.
Here&#8217;s what I came up with: DueABootin.com
As it turns out, it wasn&#8217;t very difficult at all!  (Especially being hosted through WebFaction, they make it even easier!)

First, I [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>After seeing quite a few websites with dynamic content based on the domain name, I wanted to give it a try to see how difficult it was to achieve.</p>
<p>Here&#8217;s what I came up with: <a title="DueABootin.com" href="http://reader.of.my.blog.dueabootin.com" target="_blank">DueABootin.com</a></p>
<p>As it turns out, it wasn&#8217;t very difficult at all!  (Especially being hosted through <a title="WebFaction - Hosting for an agile web" href="http://www.webfaction.com/services/hosting?affiliate=japheth" target="_blank">WebFaction</a>, they make it even easier!)<br />
<span id="more-7"></span><br />
First, I added the domain to my control panel, an added a subdomain of &#8220;*&#8221;, as you can see in the screenshot below.</p>
<p><img title="WebFaction Control Panel - DueABootin.com" src="http://japheththomson.com/img/wf_cp_dueabootin.png" alt="WebFaction Control Panel - DueABootin.com" width="371" height="202" /></p>
<p>And that&#8217;s really the hardest part, because PHP provides a nice little pre-defined variable called $_SERVER['HTTP_HOST'] which then gives us &#8220;example.dueabootin.com&#8221;, which we can pull apart and do with what we like.</p>
<p><strong>Update: I&#8217;ve had a bit of a look into how difficult it might be to achieve the same results with cPanel, and it&#8217;s not much more difficult.</strong></p>
<p>Create a new sub-domain called &#8220;*&#8221; which does not re-direct, just points to public_html/, and you should be fine.  If that alone doesn&#8217;t work, then you may need to add an A record to your DNS zone file something like:</p>
<p>*.example.com.  14400  IN  A  192.168.1.101</p>
<p>(don&#8217;t forget the trailing &#8220;.&#8221; after &#8220;.com&#8221;)</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://japh.com.au/php/fun-with-wild-card-domain-names/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>A shell for your HTML</title>
		<link>http://japh.com.au/html/a-shell-for-your-html/</link>
		<comments>http://japh.com.au/html/a-shell-for-your-html/#comments</comments>
		<pubDate>Sun, 23 Sep 2007 13:53:35 +0000</pubDate>
		<dc:creator>Japh</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.japheththomson.com/?p=5</guid>
		<description><![CDATA[Ok, so I promised you the basic structure of an HTML page.  So here is it:

&#60;!DOCTYPE html PUBLIC &#34;-//W3C//DTD XHTML 1.0 Transitional//EN&#34; &#34;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#34;&#62;
&#60;html xmlns=&#34;http://www.w3.org/1999/xhtml&#34;&#62;
&#60;head&#62;
&#60;meta http-equiv=&#34;Content-Type&#34; content=&#34;text/html; charset=utf-8&#34; /&#62;
&#60;title&#62;My First HTML Page&#60;/title&#62;
&#60;/head&#62;
&#60;body&#62;
&#60;p&#62;This is the first paragraph on the page.&#60;/p&#62;
&#60;p&#62;This is the second paragraph on the page, and it's a little bit longer than the first [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>Ok, so I promised you the basic structure of an HTML page.  So here is it:</p>

<div class="wp_codebox"><table><tr id="p513"><td class="code" id="p5code13"><pre class="html" style="font-family:monospace;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
&lt;title&gt;My First HTML Page&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;p&gt;This is the first paragraph on the page.&lt;/p&gt;
&lt;p&gt;This is the second paragraph on the page, and it's a little bit longer than the first one.  Try resizing your window to make it narrower to see the text wrap but maintain the paragraph spacing.&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></td></tr></table></div>

<p><span id="more-5"></span>Now I&#8217;ll explain what it all means!</p>
<p>The first line tells the user&#8217;s browser some basic information about how to treat the code it finds in the document.  It&#8217;s HTML, in fact, it says that it&#8217;s XHTML 1.0 Transitional.  At this point, that won&#8217;t mean much to you, and it also won&#8217;t really matter to you.  Essentially, the internet is currently transitioning from using HTML, to using XML for defining or describing the structure of a web page.  So if you&#8217;re interested in <a title="XHTML - Wikipedia" href="http://en.wikipedia.org/wiki/XHTML" target="_blank">reading more about XHTML, check out Wikipedia</a>.</p>
<p>The next line is the opening html tag.  Everything on your page should be placed within your opening and closing html tags.</p>
<p>Within your html tags, you should have a set of head tags, and a set of body tags.  Everything on your page should be within one of these two.  Content between the body tags, and various other things that we&#8217;ll get to later, between the head tags.</p>
<p>Two things we can see here already in the head tags, are a meta tag, and a title tag.  Meta tags have a number of different uses.  This particular one is defining the character set to be used on the page (UTF-8 in this case), you can also use them to define keywords for search engines and things like that.</p>
<p>The title tag defines what will appear in the user&#8217;s title bar on their browser.  For example, on this page if you look up in the title bar of your browser, you&#8217;ll see it says &#8220;Japheth Thomson&#8221;, possibly followed by some arrows and some other text (depending how you got to this article).</p>
<p>For now, you can just copy and paste the code above into a new text file, save it as template.html, and then open it in a browser to see what happens.</p>
<p>You should get a blank white page, with the words &#8220;Untitled Document&#8221; in your title bar.  Once you&#8217;ve got that working fine, try having a play with inserting paragraph tags as I talked about in my previous post to see what happens.</p>
<p>As an example, you should end up with something like this:</p>

<div class="wp_codebox"><table><tr id="p514"><td class="code" id="p5code14"><pre class="html" style="font-family:monospace;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
&lt;title&gt;My First HTML Page&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;p&gt;This is paragraph number on this HTML page.&lt;/p&gt;
&lt;p&gt;This is the second paragraph.  It's a bit longer than the first so that if you resize your window at all, you'll be able to see the text wrapping and maintaining the paragraph spacing above and below it.&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></td></tr></table></div>



<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://japh.com.au/html/a-shell-for-your-html/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
