Published: 31 January 2020
PHP is under constant development and introduces several new language features with every release. As such, it can be difficult keeping track of them all and remembering which features can be used in which version. If you are using a slightly older version of PHP you’ll need to make sure you don’t start using syntax that’s not yet available in your version.
The same goes if your server uses a different version of PHP to your development environment (although there are better ways to solve that problem such as Docker or Vagrant), or if you’re an open source developer supporting a certain version of PHP. So below we list the major syntax changes in each version along with a short example.
Update: I’ve added changes from the upcoming PHP 8 to this article. Although very few people will be using it yet, it’s useful to know what’s there and ensure you don’t get confused between trailing commas in function calls (PHP 7.3) and function definitions (PHP 8.0).
Continue reading PHP new syntax reference
Published: 20 January 2017
I came across a strange issue with PHP’s
file_get_contents function recently, when upgrading to PHP 7.1. It seemed that the function was no longer working in some existing code, and returning a blank string. Here’s what happened and how to fix it.
Continue reading PHP file_get_contents problem in PHP 7.1
Published: 18 April 2013
Conditional comments are a special feature of the Internet Explorer (IE) browser that control the display of any HTML content based on whether the visitor is using IE or another browser, and which version of IE they are using. They are supported by Internet Explorer versions 5 to 9 inclusive; from version 10, IE no longer supports conditional comments.
I’ve seen a lot of comments on websites and forums that misunderstand how condition comments actually work, so this post is an attempt to remedy that.
Continue reading How Internet Explorer conditional comments work
Published: 3 May 2012
Here is an alternate style of voting buttons for popular open source Q&A platform Question2Answer. The default setup is fine – besides the bad image quality – but this setup gives the voting a little more focus.
Default Q2A style on left; my arrangement on right.
Because the buttons are split up, implementing this requires some changes to an advanced theme.
Continue reading Alternate voting buttons for Question2Answer
Published: 1 March 2012
Question2Answer is a popular open source platform for building Q&A sites. It’s a great piece of software but the default theme leaves something to be desired. In particular, the icons used in various places around the site aren’t the best, so I made some changes to the voting arrows and best answer stars. Problems with the default setup:
- The voting buttons are poor quality: they have fixed transparency due to the GIF format and look “scratchy” around the edges.
- The images are spread across 3 files –
selected-star.png – which means multiple HTTP requests.
- The best answer stars have solid colour backgrounds, not transparent – if you don’t have a white background in your theme or blue background for the best answer then a square shows through.
- Two of the stars are almost identical so no need for separate images.
Continue reading Better icons for Question2Answer
Published: 16 July 2011
Question2Answer is a popular open source platform for building Q&A sites. Version 1.3, released last November, introduced a plugin feature to allow for further extending Question2Answer without editing core functionality. Since then I have - very slowly - been working on a Markdown editor plugin for better formatting of posts. Q2A actually comes with a WYSIWYG editor, however Markdown has several advantages:
- It’s a simple markup format that is readable as plain text.
- It defines a neat set of allowable elements, including code, block quotes, lists, links and images.
- Markdown intrinsically creates much better HTML code. If you have ever seen the HTML output of CKeditor or TinyMCE, you’ll know how plain terrible they are with even simple formatting.
Continue reading Markdown editor plugin for Question2Answer
Published: 24 July 2009
At time of writing we are using Joomla as our Content Management System (CMS) at Infused Design. It’s simple to set up and customise, and is easy for our clients to get a handle on updating their own content. There is also a large array of add-ons, known as extensions, which enhance the core functionality and provide additional features such as contact forms, galleries and even full online shops.
Behind the scenes of Joomla 1.5 is a huge framework that covers all the aspects of displaying content, including component, module, plugin and database handlers. This can be a bit daunting at first, but fortunately there are some shortcuts. This article looks at creating custom Joomla components quickly and easily by bypassing most of the official framework.
Continue reading Building Joomla components, the easy way
Published: 18 February 2007
There are several HTML elements and attributes that have now been declared deprecated by the World Wide Web Consortium (the organization that sets HTML standards). “Deprecated” means that the elements no longer serve a purpose and have been replaced by other methods, mostly involving cascading stylesheets (CSS).
Although it is recommended that web browsers continue to support them, eventually they will become obsolete. This page lists all the deprecated elements and attributes of HTML 4, and specifies the recommended replacements for them. You will need a basic understanding of CSS to implement most of these.
Continue reading Deprecated HTML 4 elements
Published: 14 February 2007
This tutorial will show you how to create HTML tables for displaying data in an organized fashion, including some neat CSS styling tricks.
Tables provide a convenient method of displaying and arranging data and other content. No doubt you are familiar with tables from other contexts - they are commonplace in word processing documents, and spreadsheets are in fact one giant table. Tables can be quite easily constructed in WYSIWYG HTML editors such as Dreamweaver or FrontPage, but for a number of reasons it really is worth knowing how the HTML code behind them fits together.
Continue reading Tables in HTML
Published: 6 April 2005
This page includes a bunch of short, one-line scripts you can add to your site easily. Create back & forward buttons, open pop-up windows, and more.