Blog


Dynamic Object Names – Navigating to method declarations in php storm

One of the things I love about PHPStorm is the way i can navigate to any function or method declaration just by cmd-clicking it (or ctrl-clicking on Windows), except when using dynamic object names. However, there is a problem when you have a dynamically named object. Here I outline the problem, and also the solution, […]

Read more...



Minify HTML using PHP

Just playing speeding up page, even if it is by milliseconds…! So i decided to minify my static html. preg_replace being as powerful as it is, makes life easy: [code] function minifyHTML($html) { return preg_replace( array(‘/<!–(.*)–>/Uis’, "/[[:blank:]]+/"), array(”, ‘ ‘), str_replace(array("\n", "\r", "\t") , ” , $html) ); } [/code] preg_replace works literally like this: […]

Read more...



Starting a new project with Cubex framework in PHP Storm

Using PHP Storm to create a new project using the Cubex Framework. In PHP Storm Starting with File > New project. You need to do three things: give the project a name choose a location choose a project type The first two are up to you, for the project type, choose “Composer project”. Next you […]

Read more...



simple contrast colour in php

I’m just building a website for my small anti-spam verification code, vericode. There are a few configurable options, background colour being one of them, and to make sure the text is still visible, i used the following PHP to do a simple test against “half of white”, and return either black or white text: [code] […]

Read more...



linking to internal pages using ckeditor 4

It’s functionality that already exists in other editors such as tinyMCE, i am surprised that linking to internal pages using ckeditor cannot be acheived in an easier (native built-in) way. So, when i develop CMS’s for various clients, i always use CKEditor, and 9 times out of 10, the client needs to link to internal […]

Read more...



fetching wordpress posts using google feeds api

Building my new website (again) and decided to feed one of my existing blogs to it, using javascript to pull in the content after the main page has loaded, usual style… i decided to use the google feeds api for fetching wordpress posts. here’s my html: [code] <div id="feeds"> <h3>From Tizards Briefcase</h3> <div class="feedBox" data-url="tizardsbriefcase.com/feed"> […]

Read more...



jquery 1.9 – adding handlers after dom load

Just started a project using jQuery 1.9 and immediately got stuck with adding handlers to elements that are created after the dom has loaded, i simply did: Prior to jQuery 1.9, adding a click (or any handler for that matter) to an element after the DOM has loaded used to be a matter of using […]

Read more...



WordPress-like slug generator

I’m building a site for a client at the moment that needs to be able to control the URLs for each of their pages (including sub pages etc), we need a WordPress-like slug generator! So, I came up with this, which i imagine is very similar to WordPress achieve the same thing (essentially stripping out […]

Read more...



bxSlider loses width when hidden & resizing the window

A bit of a title that: bxSlider loses width when resizing the window while bxSlider is hidden. Problem: bxSlider loses width when hidden. Exactly. I have a header in which i have a bxSlider (using a ul lists of li’s), this header is toggle-able (show/hide) by the user. When the user hides the header (and […]

Read more...