<?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>&#60;img /&#62; is Everything &#187; Web Development</title>
	<atom:link href="http://imgiseverything.co.uk/articles/category/web-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://imgiseverything.co.uk</link>
	<description>Manchester web designer Phil Thompson</description>
	<lastBuildDate>Wed, 01 Feb 2012 14:55:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>HTML5</title>
		<link>http://imgiseverything.co.uk/articles/html5/</link>
		<comments>http://imgiseverything.co.uk/articles/html5/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 16:40:46 +0000</pubDate>
		<dc:creator>Phil Thompson</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[html5]]></category>

		<guid isPermaLink="false">http://imgiseverything.co.uk/?p=2980</guid>
		<description><![CDATA[It certainly seems that HTML5 is starting to take hold with more and more websites launching that make use of HTML5 but how good is it? Have semantics been improved? The big selling point of HTML5 from the gurus has been that it will give HTML more semantic meaning but I just don&#8217;t believe this [...]]]></description>
			<content:encoded><![CDATA[<p>It certainly seems that HTML5 is starting to take hold with more and more websites launching that make use of HTML5 but how good is it?</p>
<p><span id="more-2980"></span></p>
<h2>Have semantics been improved?</h2>
<p>The big selling point of HTML5 from the gurus has been that it will give HTML more semantic meaning but I just don&#8217;t believe this claim.</p>
<p>Just how are the <code>&lt;section&gt;</code>, <code>&lt;article&gt;</code>, <code>&lt;aside&gt;</code> et al more semantic than simple <code>&lt;div&gt;</code> tags. I can appreciate that this may make it easier for screen-readers and search engine bots to pick up what the role of content blocks are on each page but personally I would have much preferred a different solution; one whereby <code>&lt;div&gt;</code>s can be given roles e.g.</p>
<p><code>&lt;div role="nav"&gt;</code></p>
<p>or</p>
<p><code>&lt;div role="header"&gt;</code></p>
<h2>The syntax</h2>
<p>As a lover of HTML, it&#8217;s really saddens me that the HTML5 allows HTML tags to be written in uppercase, lowercase, with closing tags, without closing tags. Whereas, I don&#8217;t much like XML&#8217;s habit of completely falling over when it reaches a validation error I do think HTML coders should be encouraged to write HTML in one single standard. </p>
<p>For me, I like the syntax of XHTML because I think it&#8217;s better practice and I would have loved to have seen HTML5 adopt that more aggressively.</p>
<h2>What I do like</h2>
<p>HTML5 is not all about those new tags, it&#8217;s supposedly more about improving web apps &#8211; and taking a lot of the things we rely upon JavaScript for like date pickers into the browser. For now though, a lot of these bits aren&#8217;t available but the good news is that the odd browser is making use of different input types and using <code>&lt;input  type="email" /&gt;</code> is a simple change and can really improve usability for iPhone users.</p>
<p>I&#8217;m also a fan of being able to wrap block level elements with links which is often a requirement and currently involves some jiggery-pokery to get it to work and validate.</p>
<h2>CSS3 &#8211; where it&#8217;s really at</h2>
<p>For me, CSS3, is really the one to watch and as more browsers support CSS3, we&#8217;ll be able to cut out extra <code>&lt;div&gt;</code>s and classes like &#8216;first&#8217;, &#8216;last&#8217;, &#8216;odd&#8217;, and &#8216;even&#8217;.</p>
<p>A lot of the post on <a href="http://24ways.org/">2009&#8242;s 24 ways</a> revolved around CSS3 and a lot of designers are starting to make use of text-shadow, rgba, box-shadow and border radius to improve their designs.</p>
<h2>Summary</h2>
<p>Honestly, I&#8217;m still not sold on HTML5, I&#8217;m yet to see the benefits of it outside of a few of its characteristics but I am building new sites with the new HTML5 doctype and whilst I&#8217;m not a fan of some of the new tags, I do think it&#8217;s moving in the right direction.</p>
<p>Instead of moaning about HTML5&#8242;s inadequacies I should be getting involved by reading the spec and joining in with the mailing list but let&#8217;s face it the <a href="http://dev.w3.org/html5/spec/Overview.html">spec</a> is a snooze-fest and the mailing list, and frankly most online discussions about HTML5, just seem like cliquey arguments for the sake of it.</p>
<h2>What do you think?</h2>
<p>Are you using HTML5? If yes, to what extent? And if not why not?</p>
]]></content:encoded>
			<wfw:commentRss>http://imgiseverything.co.uk/articles/html5/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Removing typographic widows in WordPress page titles</title>
		<link>http://imgiseverything.co.uk/articles/removing-typographic-widows-in-wordpress-page-titles/</link>
		<comments>http://imgiseverything.co.uk/articles/removing-typographic-widows-in-wordpress-page-titles/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 13:15:42 +0000</pubDate>
		<dc:creator>Phil Thompson</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[typography]]></category>
		<category><![CDATA[widows]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://imgiseverything.co.uk/?p=2658</guid>
		<description><![CDATA[A widow in typography is the one lowly word that gets displayed on a line of its own within a heading. Typographers and designers often go nuts when they see the main headings on a website have widows so here&#8217;s an easy fix to appease them: Open up the functions.php file within your WordPress theme: [...]]]></description>
			<content:encoded><![CDATA[<p>A widow in typography is the one lowly word that gets displayed on a line of its own within a heading. Typographers and designers often go nuts when they see the main headings on a website have widows so here&#8217;s an easy fix to appease them:</p>
<p><span id="more-2658"></span></p>
<p>Open up the functions.php file within your <a href="http://codex.wordpress.org/Theme_Development">WordPress theme</a>: and add the following code:</p>
<pre class="brush: php; title: ; notranslate">
/**
 *	remove_widows()
 *	filter the_title() to remove any chance of a typographic widow
 *	typographic widows
 *	@param string $title
 *	@return string $title;
 */
function remove_widows($title){

	$title_length = strlen($title);

	if(strpos($title, 'a href=') &gt; 0){
		// this is a link so
		// work out where the anchor text starts and ends
		$start_of_text = strpos($link, '&quot;&gt;');
		$end_of_text = strpos($link, '&lt;/a&gt;');
		$end_of_text = ($title_length -  $end_of_text);
		$anchor_text = substr($title, $start_of_text, $end_of_text);
	} else{
		$start_of_text = 0;
		$end_of_text = $title_length;
		$anchor_text = $title;
	}
	// convert the title into an array of words
	$anchor_array = explode(' ', $anchor_text);

	// Provided there's multiple words in the anchor text
	// then join all words (except the last two) together by a space.
	// Join the last two with an &amp;nbsp; which is where the
	// magic happens
	if(sizeof($anchor_array) &gt; 1){
		$last_word = array_pop($anchor_array);
		$title_new = join(' ', $anchor_array) . '&amp;nbsp;' . $last_word;
		$title = substr_replace($title, $title_new, $start_of_text, $end_of_text);
	}
	return $title;

}

add_filter('the_title', 'remove_widows');
</pre>
<h2>Explanation</h2>
<p>This code basically takes WordPress&#8217;s <code>the_title()</code> function and pre-filters it so that the last two words are separated not with a space but with a <code>&amp;nbsp;</code> instead (which is the HTML code for a space). This tricks the browser into not breaking up the word.</p>
<p>This code will come into action wherever the you use <code>the_title()</code> in your WordPress theme. <strong>Note:</strong> this won&#8217;t fix widows on any headings (&lt;h2&gt;, &lt;h3&gt;, &lt;h4&gt;, etc) in your body copy (which is echoed in your theme with the <code>the_content()<code> function).</p>
<h2>Semantics</h2>
<p>Another solution would be to wrap the last two words in a HTML tag like a <code>span</code> tag and then set the CSS  of that element e.g.:</p>
<pre class="brush: css; title: ; notranslate">
h1 span{
 white-space: nowrap;
}
</pre>
<p>but that involves extra HTML and extra CSS.</p>
<h2>Can you improve the code?</h2>
<p>Have you spotted an error or think you can improve upon the function? Let me know in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://imgiseverything.co.uk/articles/removing-typographic-widows-in-wordpress-page-titles/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHPNW Conference 2008 Review</title>
		<link>http://imgiseverything.co.uk/articles/phpnw08-review/</link>
		<comments>http://imgiseverything.co.uk/articles/phpnw08-review/#comments</comments>
		<pubDate>Thu, 27 Nov 2008 14:49:01 +0000</pubDate>
		<dc:creator>Phil Thompson</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[conferences]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[phpnw 08]]></category>

		<guid isPermaLink="false">http://imgiseverything.co.uk/?p=370</guid>
		<description><![CDATA[Last weekend, I opted not to spend time with my friends, nor did I choose to perform DIY on my (never finished) home; instead I decided to geek-out at the first ever PHPNW conference at Manchester Central. Upon hearing about a Manchester-based PHP conference, I got quite excited; often conferences of this ilk are very [...]]]></description>
			<content:encoded><![CDATA[<p>Last weekend, I opted not to spend time with my friends, nor did I choose to perform DIY on my (never finished) home; instead I decided to geek-out at the first ever PHPNW conference at Manchester Central.</p>
<p><span id="more-370"></span></p>
<p>Upon hearing about a <a href="http://conference.phpnw.org.uk/phpnw08/">Manchester-based PHP conference</a>, I got quite excited; often conferences of this ilk are very expensive and once you factor in the travel/accommodation expense applicable to visiting London/Brighton/Dublin etc they quickly become unaffordable so a relative inexpensive conference on my doorstep was not to be missed.</p>
<h2>What was good</h2>
<ul>
<li>The price: Early bird tickets were only ÂŁ52.25 &#8211; tremendous value</li>
<li><a href="http://conference.phpnw.org.uk/phpnw08/?p=412">The freebies</a>: Lunch was provided, lots of people won free books and there was also food and free drinks after the conference (although I had to miss that)</li>
<li>The organisation: This was a very well run event. I&#8217;m no conference whore but I have been to a few before and PHPNW was certainly the best organised I&#8217;d been to.</li>
<li><a href="http://conference.phpnw.org.uk/phpnw08/?page_id=118">Two tracks of talks</a> meant that there good choice of what to listen to.</li>
<li>I won a book (or <a href="http://digitician.co.uk/">James</a> sat next to me did, but he already owned it and gave it to me)</li>
<li>Lots of developers from all over the place. I had expected this event to be Manchester-centric but I met people from Ireland, Europe and I was really impressed by that.</li>
</ul>
<h2>What wasn&#8217;t as good</h2>
<p>I don&#8217;t wish to appear offensive or ungrateful here, as I thought the conference was great but my biggest grumble was a lack of verve from some of the speakers. The <a href="http://conference.phpnw.org.uk/phpnw08/?page_id=118">topics of the talks</a> were great &#8211; I was really looking forward to hearing them, but I found myself struggling to stay awake in some. The speakers were all very professional but I didn&#8217;t get the feeling they had done lots of speaking events before &#8211; the presentations were mostly bullet-pointed powerpoint slide and a lot of the speakers appeared slightly nervous.</p>
<p>I&#8217;m no fool, I understand that the price of the tickets means <a href="http://www.zeldman.com">Zeldman</a> or <a href="http://kevinrose.com/">Kevin Rose</a> aren&#8217;t going to show up and wow us but I did feel the presentations that I saw lacked a little personality. Often, the presenters only came alive when the time came for questions at which point they became much more lively and actually seemed to be enjoying themselves.</p>
<p>It takes a lot of balls, to stand up in front of room of nerds and present your expertise &#8211; it isn&#8217;t easy and I respect all the people who did it on the day.</p>
<p><strong>Disclaimer:</strong> The conference had two tracks and for all I know, the talks I didn&#8217;t go to could have been fascinating and full of beans.</p>
<h2>PHPNW 2009</h2>
<p>I hope there is a PHPNW 09 conference, I think the inaugural event has set some great groundwork and I fully believe any teething problems will be fully ironed out for next year.</p>
<p>There is also undoubtedly scope to increase the capacity of the event: I named-dropped PHPNW 08 quite aggressively to as many PHP developers that I came in to contact with prior to the conference but in the end I only saw one developer I knew there. I&#8217;m not sure what happened there -Â  maybe people didn&#8217;t get to hear about this conference in time, but by next year I&#8217;m sure a bit of buzz will have been created by PHPNW 08 and the interest will be much higher.</p>
<h2>Your opinion</h2>
<p>Did you go to PHPNW 08? What did you think of it? Will you be attending PHPNW 09?</p>
]]></content:encoded>
			<wfw:commentRss>http://imgiseverything.co.uk/articles/phpnw08-review/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Creating a web app&#8217;s folder/file structure</title>
		<link>http://imgiseverything.co.uk/articles/creating-a-web-apps-folderfile-structure/</link>
		<comments>http://imgiseverything.co.uk/articles/creating-a-web-apps-folderfile-structure/#comments</comments>
		<pubDate>Tue, 04 Nov 2008 09:16:26 +0000</pubDate>
		<dc:creator>Phil Thompson</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[bean counter]]></category>
		<category><![CDATA[folder structure]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[web app]]></category>

		<guid isPermaLink="false">http://imgiseverything.co.uk/?p=358</guid>
		<description><![CDATA[I&#8217;m convinced that folder/file structure plays an instrumental role in ensuring a downloadable app doesn&#8217;t confuse people and is easy to install. Whilst developing, Bean Counter, the one feature I&#8217;ve been most paranoid about is the PHP code quality. I certainly don&#8217;t consider myself to be the greatest PHPer in the world and I have [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m convinced that folder/file structure plays an instrumental role in ensuring a downloadable app doesn&#8217;t confuse people and is easy to install.</p>
<p><span id="more-358"></span><br />
Whilst developing, <a href="http://imgiseverything.co.uk/articles/bean-counter-financial-management-for-freelancers/">Bean Counter</a>, the one feature I&#8217;ve been most paranoid about is the PHP code quality. I certainly don&#8217;t consider myself to be the greatest PHPer in the world and I have this sense of foreboding, that when I finally release this app, the general consensus would be &#8216;Phil Thompson writes rubbish code&#8217;. If this app is successful then its code will be exposed to the criticisms of lots of PHP developers and they can be a cruel and unforgiving bunch.</p>
<p>These past two weeks, I&#8217;ve gone some way to ridding that feeling in the pit of my stomach by improving the app&#8217;s folder structure by I&#8217;ve turning it into a far more MVC-styled system. To be fair, it always was leaning towards MVC (even now it isn&#8217;t 100% of the way there) but I feel a lot more confident in it &#8211; it&#8217;s certainly a lot cleaner to look at.</p>
<h2>Bean Counter file structure</h2>
<ul>
<li><strong>application</strong>
<ul>
<li>.htaccess</li>
<li>ajax</li>
<li>behaviour</li>
<li>class</li>
<li>controllers</li>
<li>images</li>
<li>inc</li>
<li>style</li>
<li>views
<ul>
<li>common</li>
<li>forms</li>
<li>layout</li>
</ul>
</li>
</ul>
</li>
<li><strong>site</strong>
<ul>
<li>.htaccess</li>
<li>cache</li>
<li>downloads</li>
<li>index.php</li>
<li>local_files.php</li>
</ul>
</li>
</ul>
<p>You may notice it takes a lot of inspiration from frameworks like Zend, Cake, etc. There is a solid reasoning behind this wholesale thievery;  its familiarity should hopefully make developers, who download it, feel more comfortable with the codebase.</p>
<p>The idea behind this app is that it should allow easy updating/editing for people&#8217;s individual requirements so modelling it on a conventional MVC structure makes sense.</p>
<h3>Some weirdness explained</h3>
<p>The images, style and behaviour folders are in the application folder whereas the cache and downloads folder are in the site folder &#8211; they should be the other way around (and would be in normal circumstances) but all the beta testing so far been on my server and so by swapping these folders around, from their usual location, has allowed me to share the application folder between multiple installs whilst making sure the cache and downloads folders are unique to each install.</p>
<p>The file local_files.php takes requests for CSS, JavaScript, and images from mod_rewrite and routes them through the application folder&#8217;s relevant structure.</p>
<h3>What no models folder?</h3>
<p>Models live in the class folder. Not all classes relate to models so, yes, I know this is bad form and I should separate them out again but at this stage I think classes that relate to database models and classes that relate to the application&#8217;s functionality are best left together.</p>
<h2>So when is the release date?</h2>
<p>After months of inactivity, I&#8217;ve started working on this app again and its currently in another round of <a href="http://imgiseverything.co.uk/articles/beta-testing-lessons/">beta testing</a> which I hope will only uncover minor bugs. I think I&#8217;m quite close to a release date, I have the following things left to do:</p>
<ul>
<li>Finish the sales site</li>
<li>Write help documentation</li>
<li>Decide whether it&#8217;ll be free or not</li>
<li>Beta test people installing the app locally/on their own servers</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://imgiseverything.co.uk/articles/creating-a-web-apps-folderfile-structure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How I debug CSS in IE6</title>
		<link>http://imgiseverything.co.uk/articles/how-i-debug-ie6/</link>
		<comments>http://imgiseverything.co.uk/articles/how-i-debug-ie6/#comments</comments>
		<pubDate>Fri, 31 Oct 2008 15:17:39 +0000</pubDate>
		<dc:creator>Phil Thompson</dc:creator>
				<category><![CDATA[Best of]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[browsers]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[ie6]]></category>

		<guid isPermaLink="false">http://imgiseverything.co.uk/?p=340</guid>
		<description><![CDATA[I make my living as a Front-end Web Developer, which means I spend quite a bit of time making websites look as good in Internet Explorer 6 (IE6) as they do in other browsers. It isn&#8217;t rocket science and I&#8217;ve honed my technique to make bug fixing as quick and easy as possible. Prevention is [...]]]></description>
			<content:encoded><![CDATA[<p>I make my living as a Front-end Web Developer, which means I spend quite a bit of time making websites look as good in Internet Explorer 6 (IE6) as they do in other browsers. It isn&#8217;t rocket science and I&#8217;ve honed my technique to make bug fixing as quick and easy as possible.</p>
<p><span id="more-340"></span></p>

<a href='http://imgiseverything.co.uk/articles/how-i-debug-ie6/ie6/' title='This website in IE6 (via VMware Fusion)'><img width="460" height="270" src="http://imgiseverything.co.uk/wp-content/uploads/2008/10/ie6.gif" class="attachment-medium" alt="This website in IE6 (via VMware Fusion)" title="This website in IE6 (via VMware Fusion)" /></a>
<a href='http://imgiseverything.co.uk/articles/how-i-debug-ie6/ie6-toolbar/' title='IE6 Accessibility Toolbar&#039;s CSS Editor'><img width="460" height="367" src="http://imgiseverything.co.uk/wp-content/uploads/2008/10/ie6-toolbar.gif" class="attachment-medium" alt="IE6 Accessibility Toolbar&#039;s CSS Editor" title="IE6 Accessibility Toolbar&#039;s CSS Editor" /></a>
<a href='http://imgiseverything.co.uk/articles/how-i-debug-ie6/ie6-colours/' title='This website with background colours applied'><img width="460" height="175" src="http://imgiseverything.co.uk/wp-content/uploads/2008/10/ie6-colours.gif" class="attachment-medium" alt="This website with background colours applied" title="This website with background colours applied" /></a>

<h2>Prevention is better than a cure</h2>
<p>If I have to spend a long time debugging IE6, it&#8217;s likely it&#8217;s because I&#8217;m fixing someone else&#8217;s code. There are certain procedures you can undertake when writing your CSS which will make sure IE6 headaches are kept to an absolute minimum and unfortunately, not everyone knows about them.</p>
<h3>Rule 1: Reset those default styles</h3>
<p>Prior to resetting styles, I used to get all kinds of problems cross-browsers with IE and Firefox. I started off using this:</p>
<p><code>*{<br />
margin: 0;<br />
padding: 0;<br />
}</code></p>
<p>before moving on to the <a href="http://developer.yahoo.com/yui/reset/">YUI reset</a> and then finally settling on <a href="http://meyerweb.com/eric/tools/css/reset/">Eric Meyer&#8217;s Reset</a>.</p>
<h3>Rule 2: Don&#8217;t declare margin/padding and width on the same item</h3>
<p>You must have been living under a rock, if you don&#8217;t know about IE6&#8242;s crappy <a href="http://www.456bereastreet.com/archive/200612/internet_explorer_and_the_css_box_model/">box model</a>. If you need to set a width on an item try not to set a margin/padding (on the left or right) on it too. I get round this by declaring padding/margin (depending on the design) to my &lt;p&gt;,&lt;ul&gt;,&lt;table&gt;,&lt;hr&gt; , etc elements.</p>
<p>In most cases, a designer will set the same guttering on all text on a page &#8211; anywhere from 8px to 20px (but often 10px) so:</p>
<p><code>p{<br />
padding: 0 10px;<br />
}</code></p>
<p>is often a great trick. <strong>Side note:</strong> I&#8217;ll always use pixels for the left/right margins/padding because as soon as you start to use ems, you can get discrepancies when you have items in the same &lt;div&gt; with differing fonts sizes.</p>
<h3>Rule 3: Use valid XHTML/HTML</h3>
<p>I&#8217;ve lost count of the times, when I&#8217;ve struggled with a layout that looks perfect in Firefox/Safari but awful in IE6. If it also looks crappy in IE7 then more often than not the HTML will be invalid with a &gt; or a &lt; missing. For some reason, the other browsers allow this kind of thing to go by unpunished but IE is a stickler for the rules.</p>
<p>I use the <a href="https://addons.mozilla.org/en-US/firefox/addon/249">HTML validator Add-on</a> for Firefox to let me know if my pages are valid.</p>
<h3>Rule 4: Float nearly everything</h3>
<p>When I write CSS I make sure virtually all my elements are floated &#8211; this works fantastically provided designs are of a fixed width &#8211; if they&#8217;re not a fixed width (they should be &#8211; but let&#8217;s not get into that) then you&#8217;ll need to use the <a href="http://www.positioniseverything.net/easyclearing.html">clearfix solution</a> (a lot) because if an item is floated and its parent element isn&#8217;t floated too, the parent element will forget its responsibility to be at least long as its child elements.</p>
<h2>Debugging</h2>
<p>I have over 3 years of IE6+CSS experience so I&#8217;ve seen most problems &#8211; and instinctively I know how to fix most issues I stumble across, but there are times when I can&#8217;t fathom what&#8217;s wrong. When that happens here&#8217;s what I do:</p>
<ul>
<li>Load up Windows XP in <a href="http://www.vmware.com/download/fusion/">VMware Fusion</a> (OS X) which is better than Parallels (in my opinion)</li>
<li>Load up Internet Explorer 6</li>
<li>Make sure the <a href="http://www.visionaustralia.org.au/ais/toolbar/">IE Accessibility Toolbar</a> is installed</li>
<li>Use the Edit CSS option in the toolbar</li>
<li>Then I start the &#8216;magic&#8217;</li>
</ul>
<h3>Trial and error</h3>
<p>More often than not, problems in IE6 are caused by the width of items. An item one pixel too wide will knock columns underneath each other, but it can be hard to work out which element is causing the extra width.</p>
<p><strong>Background colours</strong></p>
<p>I&#8217;ll often set a background colour on major structural elements</p>
<p><code>#content{background-color: red;}</code><br />
<code>#sidebar{background-color:blue;}</code></p>
<p>This lets me see which element is causing the problem.</p>
<h3>Hide elements</h3>
<p>Then I&#8217;ll start to hide elements, starting with the biggest surrounding &lt;div&gt; and working my way in. So if I start with:</p>
<p><code>#sidebar{display: none;}</code></p>
<p>the problem should vanish (along with most the of the page) but does the problem still go away if I try the following?</p>
<p><code>#sidebar .sub-item{display: none;}</code></p>
<p>or</p>
<p><code>#sidebar .sub-item .sub-sub-item{display: none;}</code></p>
<p>Using this method I can establish which item is causing the problem. Often it may be a &lt;div&gt;, a &lt;p&gt;, or another item nested several layers deep.</p>
<h3>Checking for solutions</h3>
<p>IE6 is an outlaw; it often invents its own rules by which to render CSS. Once I&#8217;ve discovered a problem element, there is often no rhyme or reason why it is causing a problem so I&#8217;ll try the following rules:</p>
<p><code>#sidebar .sub-item .sub-subitem{<br />
position: relative; /*  try setting this if it's not already set - it sometimes works wonders */<br />
display: inline; /* display: inline often fixes the double margin float bug and */<br />
display: inline-block; /* Sometimes this just fixes problems - no idea why */<br />
margin: 0; /* margin can be a killer so take it off completely see if the problem goes away */<br />
padding: 0; /* same as margin */<br />
background-color: transparent; /* Sometimes IE6 hates background colours not being declared */<br />
overflow: hidden; /* can sometimes stop columns too wide from breaking a layout */<br />
zoom: 1; /* Sometimes forces hasLayout and fixes things */<br />
}</code></p>
<p>I&#8217;ll often experiment with a few of these different rules with margin or display being my most popular problem solvers. I&#8217;ll also check Google for answers to see if anyone else on the web has encountered a random bug.</p>
<h2>Fixing</h2>
<p>Once I have my solutions I&#8217;ll put them in a separate stylesheet often called ie6.css and include it onto a page with a <a href="http://www.javascriptkit.com/howto/cc2.shtml">conditional comment</a>. Making sure it is the last stylesheet imported/linked on the page. This is better than putting your fixing in with the rest of your CSS as it allows you to manage it better &#8211; that&#8217;s my opinion anyway.</p>
<h2>Summary</h2>
<p>That&#8217;s how I debug CSS in IE6. Do you have a similar method?</p>
]]></content:encoded>
			<wfw:commentRss>http://imgiseverything.co.uk/articles/how-i-debug-ie6/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Hello Google Chrome, welcome to the internet</title>
		<link>http://imgiseverything.co.uk/articles/google-chrome/</link>
		<comments>http://imgiseverything.co.uk/articles/google-chrome/#comments</comments>
		<pubDate>Fri, 05 Sep 2008 11:48:44 +0000</pubDate>
		<dc:creator>Phil Thompson</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[browsers]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[google chrome]]></category>

		<guid isPermaLink="false">http://imgiseverything.co.uk/?p=290</guid>
		<description><![CDATA[This week saw the launch of the internet&#8217;s newest web browser, Google Chrome and what kind of frontend developer would I be if I didn&#8217;t give it a quick review? Screenshot of Google Chrome in action Google Chrome is only available for Windows right now so Mac users will have to wait for the time [...]]]></description>
			<content:encoded><![CDATA[<p>This week saw the launch of the internet&#8217;s newest web browser, Google Chrome and what kind of frontend developer would I be if I didn&#8217;t give it a quick review?</p>
<p><span id="more-290"></span></p>
<div class="images">
<ul>
<li><img src="http://imgiseverything.co.uk/wp-content/uploads/2008/09/chrome.gif" alt="" title="Google Chrome screenshot" width="460" height="347" /></li>
</ul>
<div class="caption">
Screenshot of Google Chrome in action
</div>
</div>
<p><a href="http://www.google.com/chrome">Google Chrome</a> is only available for Windows right now so Mac users will have to wait for the time being. Although to be honest, Google Chrome isn&#8217;t enough to switch people from Safari nor Firefox for that matter. However, it is more than enough to encourage people to switch from Internet Explorer 6 and 7.</p>
<p>As a developer, I&#8217;ll continue to use Firefox (for now) because the <a href="https://addons.mozilla.org/en-US/firefox/addon/60">Web Developer toolbar</a>, <a href="https://addons.mozilla.org/firefox/addon/1843">Firebug</a>, <a href="https://addons.mozilla.org/addon/3829">LiveHTTPHeaders</a>  and all the other add-ons are just too good to be without.</p>
<h2>Target market</h2>
<p>Where I hope Google Chrome (terrible name by the way), will catch on is with a less technically-minded audience. Provided Google can convince them to download it (and if anyone can Google can) then this will be a major success that could really reduce the number of people using Internet Explorer to the minority.</p>
<h2>Appearance</h2>
<p><a href="http://www.hicksdesign.co.uk/journal/initial-thoughts-on-google-chrome">Some people have criticised the new browser&#8217;s looks</a> but, for me, I think it looks just fine. It doesn&#8217;t look garish nor does it look boring and I think it will appeal to the audience it is aimed at perfectly. </p>
<p>I do think that the choice of name, Chrome, is a bit bizarre. Safari, Netscape and Internet Explorer are great browser names &#8211; they give the user the idea that they are exploring the world which is what you do when you go online. Internet Explorer is an especially great name, because it literally tells the user what it is for whereas Chrome doesn&#8217;t at all but as the Chrome brand develops this will probably become a trivial non-issue.</p>
<h2>Usability and speed</h2>
<p>I can&#8217;t really fault Chrome for how it works. Prior to downloading it I thought having the tabs above the address bar would be weird but it isn&#8217;t at all. In fact, it may more sense in many ways. In terms of speed, I haven&#8217;t noticed it to be particularly quicker than other browsers but then I haven&#8217;t used it extensively yet.</p>
<h2>What do you think?</h2>
<p>Have you downloaded Google chrome yet? What are your thoughts?</p>
]]></content:encoded>
			<wfw:commentRss>http://imgiseverything.co.uk/articles/google-chrome/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Should you test your web developers before employing them?</title>
		<link>http://imgiseverything.co.uk/articles/web-developer-test/</link>
		<comments>http://imgiseverything.co.uk/articles/web-developer-test/#comments</comments>
		<pubDate>Wed, 20 Aug 2008 09:23:02 +0000</pubDate>
		<dc:creator>Phil Thompson</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[freelance]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[recruitment]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[web developer]]></category>

		<guid isPermaLink="false">http://imgiseverything.co.uk/?p=288</guid>
		<description><![CDATA[These past few weeks, I&#8217;ve been doing some work for a new client. Prior to getting the gig, I did the all the usual things: sent my prospective email, went to meet the client, etc. However, this client, a big web agency, did something I&#8217;ve not experienced before &#8211; they gave me a programming test. [...]]]></description>
			<content:encoded><![CDATA[<p>These past few weeks, I&#8217;ve been doing some work for a new client. Prior to getting the gig, I did the all the usual things: sent my prospective email, went to meet the client, etc. However, this client, a big web agency, did something I&#8217;ve not experienced before &#8211; they gave me a programming test.</p>
<p><span id="more-288"></span></p>
<div class="images">
<ul>
<li><img src="http://imgiseverything.co.uk/wp-content/uploads/2008/08/istock_000006036337small-460x516.jpg" alt="" title="" width="460" height="516"  /></li>
</ul>
<div class="caption">
I have a stock photography account and I&#8217;m not afraid to use it.
</div>
</div>
<h2>What the test involved</h2>
<p>Did I say <em>test</em>? Actually it was more like a challenge and no I won&#8217;t tell you what the challenge was nor who the agency is so as to save them having to change their test. Suffice to say, the challenge was to create a PHP version of a simple game.</p>
<p>They didn&#8217;t ask me to perform the challenge there and then &#8211; they asked that I go away and have a solution within a day or two. This first part of the challenge is all about time management and ensuring the employee is capable of meeting (relatively) simple deadlines.</p>
<p>After getting over my initial frustration and bewilderment, I thought, &#8216;How dare they ask me to do work without paying me!&#8217;, &#8216;Don&#8217;t they know how busy I am?&#8217;. Once I started the assignment, I discovered that I actually loved doing it. Although, the agency stated they were more interested in how I went about the implementing the game (in an <a href="http://en.wikipedia.org/wiki/Model-view-controller">MVC</a> fashion) &#8211; if I did 30 minutes work in the right way and it wasn&#8217;t finished &#8211; that would be better than spending 4 hours, getting it to work but in the wrong way. I actually wanted to get this challenge finished to perfection but I wonder if that says more about my personality and than the test per se.</p>
<h2>The advantages of testing</h2>
<p>I fully understand why these guys test their programmers, they&#8217;re a very busy web agency, producing top level work, and they need experienced people to hit the ground running. They don&#8217;t want to hire someone who talks the talk in the interview but on their first day they admit to not knowing any PHP5 or <a href="http://imgiseverything.co.uk/2008/06/06/php-html-templates/">CSS</a>.</p>
<p>The more Manchester web agencies I speak to, the more I hear the same thing &#8211; that they are struggling to find <a href="http://imgiseverything.co.uk/2007/12/31/junior-web-developer-salary/">good web developers</a> &#8211; to be honest, a lot of them are struggling to find bad web developers. Although testing potential employees might not gain you more applicants it could get you better employees and enhance your reputation amongst developers as an agency where they want to work.</p>
<p>Since working at this agency, I&#8217;ve seen quite a few developers and they all seem to know their stuff. I&#8217;m convinced (and so are the agency in question) that this test is responsible for weeding out any bad apples who otherwise may have found themselves employed. </p>
<h2>Summary</h2>
<p>If I had a web agency would I challenge the programmers before hiring them? Yes, I think I would unless I had already seen their code and knew it was up to scratch.</p>
<p>Have you been tested before starting a job? What did you think of the process?</p>
]]></content:encoded>
			<wfw:commentRss>http://imgiseverything.co.uk/articles/web-developer-test/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Take 2 web apps into the shower?</title>
		<link>http://imgiseverything.co.uk/articles/2-web-apps/</link>
		<comments>http://imgiseverything.co.uk/articles/2-web-apps/#comments</comments>
		<pubDate>Thu, 31 Jul 2008 09:50:13 +0000</pubDate>
		<dc:creator>Phil Thompson</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[bean counter]]></category>
		<category><![CDATA[cart45]]></category>
		<category><![CDATA[productivity]]></category>
		<category><![CDATA[web apps]]></category>

		<guid isPermaLink="false">http://imgiseverything.co.uk/?p=286</guid>
		<description><![CDATA[Since announcing the launch of Cart45 last week, I&#8217;ve had quite a few people asking how I&#8217;ve managed to create an ecommerce app and another web app (Bean Counter) simultaneously. So here goesâ€¦ Disclaimer Whilst, Cart45 is still available for purchase, I am no longer involved in its development in any way. Thus, I cannot [...]]]></description>
			<content:encoded><![CDATA[<p>Since announcing the <a href="http://imgiseverything.co.uk/2008/07/23/cart45-ecommerce/">launch of Cart45</a> last week, I&#8217;ve had quite a few people asking how I&#8217;ve managed to create an ecommerce app and <a href="http://imgiseverything.co.uk/2008/06/25/launching-your-own-web/">another web app</a> (Bean Counter) simultaneously. So here goesâ€¦</p>
<p><span id="more-286"></span></p>
<div style="background:#FFEE91;border:1px dotted #151515;color:#151515;margin: 10px;">
<h2>Disclaimer</h2>
<p>Whilst, Cart45 is still available for purchase, I am no longer involved in its development in any way. Thus, I cannot answer questions about it nor offer any kind of support.</p>
</div>
<p>I must admit, my working arrangement is downright bizarre &#8211; my employer Soapy Co Ltd allow me to work from home and pay me a salary but they also allow me to spend 20% of my time (the equivalent of 1 day a week) on my own projects. This allows for a couple of distinct advantages for me and them.</p>
<ol>
<li>Allows me to experiment with new ideas</li>
<li>Allows me to freelance with other agencies and gain more experience</li>
<li>Allows me to fit work around my life</li>
</ol>
<p>The most important thing my employers care about is that my work gets done &#8211; and it does. So does it matter whether I sit still from 9am-5pm spreading out my tasks so they last a full working day or is it more important that I get done what needs to be done on time?</p>
<h2>Experimenting with new ideas</h2>
<p>Whilst writing Cart45, I was simultaneously writing Bean Counter, this allowed me to experiment with new ideas and techniques in Bean Counter that if successful could be transferred across to Cart45. As Bean Counter is all my own, I haven&#8217;t been constricted to any deadlines (except my own), which has enabled me to be less stressed about how quickly I developed it. This in turn, meant I could concentrate on ensuring the code looked good and worked well regardless of how long it took &#8211; whereas with Cart45 it is always a rush to make sure the product works as quickly as possible. That&#8217;s simply the nature of a commercial product whose sales will guarantee the success of its parent company.</p>
<h2>Freelancing</h2>
<p>This unique working environment allows me to freelance more and more than a 9-5 office job would. As I mentioned above, provided my work is done my employers don&#8217;t care what hours I work. If I wish to blitz an entire week&#8217;s worth of projects over the course of 2-3 days I can &#8211; often I choose not to because when I take into account the cost of the RedBull and ProPlus it works out unprofitable in most cases.</p>
<p>Blitzing the odd week does allow me to get some freelancing for other agencies done &#8211; it even enables me to work onsite when required. Getting out and about and seeing how other people operate is massively helpfully to my career development and any insights I can gain can be taken back to my employer to help improve their practices.</p>
<h2>Fitting work around my life</h2>
<p>Doctors appointment, hair cuts, trips to the butchers/fishmongers &#8211; all these errands used to be crammed into the weekend leaving me with no time whatsoever to relax, but because I now work from home I can do these things quickly during the day without losing much productivity and in fact, it helps me to take my mind off programming.</p>
<p>We bought our first house 20 months ago and we&#8217;ve been renovating it ever since. Working from home has definitely sped up the DIY a lot. If I&#8217;m stuck with a certain aspect of Cart45 development I can go off for 20 minutes and paint some walls or sand down a banister and that little break clears my mind and often helps me solve my programing problem.</p>
<h2>FAQ</h2>
<p>Friends and co-workers often have these similar queries about my work situation:</p>
<h3>Is it hard to motivate yourself when you work from home?</h3>
<p>Actually, it&#8217;s surprisingly easy to motivate myself and I don&#8217;t think I&#8217;m atypical here, just ask my parents &#8211; they used to tear their hair out over my unmotivated approach to school and life. In my opinion, you have to be a lot more motivated to physically get up and get yourself out of the house on time every day regardless of the weather or how you&#8217;re feeling.</p>
<h3>Do you spend all day working in your underwear?</h3>
<p>Yes. Monday-Thursday it&#8217;s high class Agent Provocateur and Friday&#8217;s is casual big pants day. Seriously, though I try not to work in pajamas and dress as I would if I were at the office. This approach seems to make me concentrate a little more &#8211; although it may be (more than) a little psychosomatic. </p>
<h3>Is it lonely?</h3>
<p>Yes sometimes it is. I can go full days without talking to anyone except my girlfriend once she gets home from work. Freelancing on-site for other agencies can help to break up this monotony.</p>
<h3>Do you lie in everyday?</h3>
<p>No. As a teenager I could sleep-in until mid-afternoon but those days are now long gone. Nowadays, I find myself most productive in the morning and the later I sleep in, the later I want to go to bed at night and as my girlfriend starts work at 8am it make sense to try and keep our bod clocks in time.</p>
<h2>What about you?</h2>
<p>Do you work from home? What are your experiences like?</p>
]]></content:encoded>
			<wfw:commentRss>http://imgiseverything.co.uk/articles/2-web-apps/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Lessons learnt from beta testing</title>
		<link>http://imgiseverything.co.uk/articles/beta-testing-lessons/</link>
		<comments>http://imgiseverything.co.uk/articles/beta-testing-lessons/#comments</comments>
		<pubDate>Tue, 01 Jul 2008 08:34:20 +0000</pubDate>
		<dc:creator>Phil Thompson</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[bean counter]]></category>
		<category><![CDATA[beta testing]]></category>
		<category><![CDATA[web app]]></category>

		<guid isPermaLink="false">http://imgiseverything.co.uk/?p=267</guid>
		<description><![CDATA[Last week, saw the completion of the first round of beta testing for Bean Counter. Was the beta testing a success? No, not really. What went wrong? I made a few mistakes in terms of the testing. I accepted anyone into the testing programme I didn&#8217;t create a set test plan for them to follow [...]]]></description>
			<content:encoded><![CDATA[<p>Last week, saw the completion of the first round of beta testing for <a href="http://beancounterhq.com">Bean Counter</a>. Was the beta testing a success? No, not really.</p>
<p><span id="more-267"></span></p>
<h2>What went wrong?</h2>
<p>I made a few mistakes in terms of the testing.</p>
<ul>
<li>I accepted anyone into the testing programme</li>
<li>I didn&#8217;t create a set test plan for them to follow</li>
<li>I didn&#8217;t provide any clear feedback procedure</li>
</ul>
<p>The biggest error of judgement was simply to accept anyone who wanted to test the application. In reality, it only makes sense to test people who will either test the application really strongly and try to break it or people who form part of your target market.</p>
<p>I chose people who, despite their enthusiasm, didn&#8217;t actually do very much testing. Sorry guys, if you&#8217;re reading this but here are the stats:</p>
<ul>
<li>10 beta testers</li>
<li>5 didn&#8217;t even look at their test page</li>
<li>4 people installed the system but didn&#8217;t get any further</li>
<li>1 person installed the system went away and logged back in the following day</li>
</ul>
<p>These stats left a problem &#8211; what were the reasons behind their lack of interest once being given the keys? It could&#8217;ve have been a number of reasons: a lack of time, a confusing application, a lack of a test plan. At this stage I do not know why.</p>
<p>I was so excited that anyone wanted to beta test my application and give up their time to help me for nothing. Beta testing does seem to create a buzz and if someone asked me to beta test a new web app that looked remotely interesting &#8211; I&#8217;d probably agree too &#8211; but I&#8217;d probably also lose interest when it quickly became obvious that I&#8217;d have to put some effort in for literally no reward.</p>
<h2>No test plan</h2>
<p>I suspect a missing test plan didn&#8217;t help. I foolishly asked people to simply play around with the system and casually email me back with their thoughts. This isn&#8217;t a good way to do things &#8211; without some kind of formal procedure, people are unlikely to test an application properly add to the fact that these testers were vetted &#8211; I have no idea if they wanted from the system what the system was offering.</p>
<h2>No feedback procedure</h2>
<p>By failing to create a formal procedure for feedback and relying upon casual email correspondence, meant I got very little feedback from the testers. Nobody emailed except maybe to say it was good or ok. Which when you&#8217;re trying to find bugs and see how useful something is &#8211; isn&#8217;t very helpful.</p>
<h2>What I should have done</h2>
<p>Next time I beta test anything, I&#8217;ll be choosing the testers very carefully and finding some way to reward them properly. I&#8217;ll be creating a test plan and asking the testers to make sure they perform a few key tasks and finally I&#8217;ll be writing some forms (preferably built into the application) that allow for quick and easy feedback possibly in a questionnaire format with simple options.</p>
<p>The (almost complete) failure of this test was my fault and not the testers&#8217; and I don&#8217;t want to appear as though I am blaming other people for the mistakes I made.</p>
<p>There was one saving grace from the trial, I did learn that my installation technique for multiple customers needed improving, which it now has. At the start of the trials, setting up a new account took about 20 minutes whereas now it takes 5 minutes.</p>
]]></content:encoded>
			<wfw:commentRss>http://imgiseverything.co.uk/articles/beta-testing-lessons/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>{curly brackets} versus :colons/semi-colons; in PHP</title>
		<link>http://imgiseverything.co.uk/articles/curly-brackets-colons-php/</link>
		<comments>http://imgiseverything.co.uk/articles/curly-brackets-colons-php/#comments</comments>
		<pubDate>Tue, 10 Jun 2008 13:15:06 +0000</pubDate>
		<dc:creator>Phil Thompson</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[code examples]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[readability]]></category>

		<guid isPermaLink="false">http://imgiseverything.co.uk/?p=260</guid>
		<description><![CDATA[Current and former colleagues of mine, will attest to my intense hatred of poorly written code and by poorly written code I mean code that is hard to follow. In a bid to make my PHP code even more readable I&#8217;m dumping the curly brackets traditionally used with control structures (e.g. ifs, fors, switches) in [...]]]></description>
			<content:encoded><![CDATA[<p>Current and former colleagues of mine, will attest to my intense hatred of poorly written code and by poorly written code I mean code that is hard to follow. </p>
<p><span id="more-260"></span><br />
In a bid to make my PHP code even more readable I&#8217;m dumping the curly brackets traditionally used with control structures (e.g. ifs, fors, switches) in favour of the colons and semi-colons of <a href="http://uk2.php.net/manual/en/control-structures.alternative-syntax.php">PHP&#8217;s alternative alternative syntax for control structures</a>.</p>
<h2>PHP&#8217;s traditional syntax for control structures &#8211; with curly brackets {}</h2>
<ol class="codelist">
<li class="tab0 odd"><code>&lt;?php</code></li>
<li class="even">&nbsp;</li>
<li class="tab1 odd"><code>// If statement</code></li>
<li class="tab1 even"><code>if(1==1){</code></li>
<li class="tab2 odd"><code>doSomething();</code></li>
<li class="tab1 even"><code>}</code></li>
<li class="tab1 odd"><code>else if(1&gt;1){</code></li>
<li class="tab2 even"><code>doSomethingElse();</code></li>
<li class="tab1 odd"><code>}</code></li>
<li class="tab1 even"><code>else{</code></li>
<li class="tab2 odd"><code>doSomethingSpecial();</code></li>
<li class="tab1 even"><code>}</code></li>
<li class="odd">&nbsp;</li>
<li class="tab1 even"><code>// For loop</code></li>
<li class="tab1 odd"><code>for($i = 1; $i &lt; 5; $i++){</code></li>
<li class="tab2 even"><code>echo $i;</code></li>
<li class="tab1 odd"><code>}</code></li>
<li class="even">&nbsp;</li>
<li class="tab0 odd"><code>?&gt;</code></li>
</ol>
<p>Upon quick glance the usage of curly brackets it is obvious which bracket belongs to which control but it soon becomes more difficult to read when functions/methods are thrown into the mix and lots of nested controls exist.</p>
<h3>Too many curly brackets {{{{{{}}}}}}</h3>
<ol class="codelist">
<li class="tab0 odd"><code>&lt;?php</code></li>
<li class="even">&nbsp;</li>
<li class="tab1 odd"><code>// Nested if's and foreach's statement inside a function</code></li>
<li class="even">&nbsp;</li>
<li class="tab1 odd"><code>function myFunction(){</code></li>
<li class="tab2 even"><code>if($trees ==  'green'){</code></li>
<li class="tab3 odd"><code>if($trees &gt; $children){</code></li>
<li class="tab4 even"><code>foreach($array as $key =&gt; $value){</code></li>
<li class="tab5 odd"><code>if($trees != 'dead'){</code></li>
<li class="tab6 even"><code>doSomething();</code></li>
<li class="tab5 odd"><code>}</code></li>
<li class="tab4 even"><code>}</code></li>
<li class="tab3 odd"><code>}</code></li>
<li class="tab3 even"><code>else{</code></li>
<li class="tab4 odd"><code>doSomethingElse();</code></li>
<li class="tab3 even"><code>}</code></li>
<li class="tab2 odd"><code>}</code></li>
<li class="tab2 even"><code>else{</code></li>
<li class="tab3 odd"><code>doSomethingSpecial();</code></li>
<li class="tab2 even"><code>}</code></li>
<li class="tab1 odd"><code>}</code></li>
<li class="even">&nbsp;</li>
<li class="tab0 odd"><code>?&gt;</code></li>
</ol>
<p>The example above, shows it becoming a little more difficult to follow which bracket refer to which control. <em>The very fact that my method of displaying code samples (<a href="http://elasticdog.com/2004/09/code-viewer/">codeviewer</a>) removes indentation/tabs from the code makes this even ore evident.</em></p>
<h2>PHP &#8216;s alternative alternative syntax for control structures :;</h2>
<ol class="codelist">
<li class="tab0 odd"><code>&lt;?php</code></li>
<li class="even">&nbsp;</li>
<li class="tab1 odd"><code>// If statement</code></li>
<li class="tab1 even"><code>if(1==1):</code></li>
<li class="tab2 odd"><code>doSomething();</code></li>
<li class="tab1 even"><code>elseif(1 &gt; 1):</code></li>
<li class="tab2 odd"><code>doSomethingElse();</code></li>
<li class="tab1 even"><code>else:</code></li>
<li class="tab2 odd"><code>doSomethingSpecial();</code></li>
<li class="tab1 even"><code>endif;</code></li>
<li class="odd">&nbsp;</li>
<li class="tab1 even"><code>// for loop</code></li>
<li class="tab1 odd"><code>for($i = 1; $i &lt; 5; $i++):</code></li>
<li class="tab2 even"><code>echo $i;</code></li>
<li class="tab1 odd"><code>endfor;</code></li>
<li class="even">&nbsp;</li>
<li class="tab1 odd"><code>// nested if statements inside a function</code></li>
<li class="tab1 even"><code>function myFunction(){</code></li>
<li class="tab2 odd"><code>if($trees ==  'green'):</code></li>
<li class="tab3 even"><code>if($trees &gt; $children):</code></li>
<li class="tab4 odd"><code>doSomething();</code></li>
<li class="tab3 even"><code>else:</code></li>
<li class="tab4 odd"><code>doSomethingElse();</code></li>
<li class="tab3 even"><code>endif;</code></li>
<li class="tab2 odd"><code>else:</code></li>
<li class="tab3 even"><code>doSomethingSpecial();</code></li>
<li class="tab2 odd"><code>endif;</code></li>
<li class="tab1 even"><code>}</code></li>
<li class="odd">&nbsp;</li>
<li class="tab0 even"><code>?&gt;</code></li>
</ol>
<p>For me, I find this so much easier to read. Replacing the last curly bracket (<code>}</code>) is a statement of the following <code>endif;</code>, <code>endfor;</code>, <code>endswitch;</code> etc. This means there less confusion as to what things are referring to.</p>
<h2>Summary</h2>
<p>It is imperative to write code that makes sense for other developers in your team or for the developers will inherit your code.</p>
<p>I find this alternative control structure much easier to read but what do you think? Do you find it easier or harder to read?</p>
]]></content:encoded>
			<wfw:commentRss>http://imgiseverything.co.uk/articles/curly-brackets-colons-php/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>

