Mobile web – introduction

Posted: July 31st, 2009 | Author: | Filed under: Mobile Browsers | Comments Off on Mobile web – introduction

I’m not a marketing specialist, but I can see a lot of things change very quickly when we talk about mobile devices. Since its invention the mobile phone became indispensable in our lives. The mobile phone is used mainly for business purposes, but this is changing day by day: The market is moving fast to consumers too. With more people using a high-end phone, the capabilities for mobile web design give developers the opportunity to focus on this group of people as well.

Many people think it’s hard to make their website suitable for mobile devices, but this isn’t the case at all. In this article I’ll introduce a couple of things you should consider before developing a mobile website. In a future article I’ll give some hands-on advice on where to start. Read the rest of this entry »

__PHP_Incomplete_Class Object

Posted: July 21st, 2009 | Author: | Filed under: PHP | 3 Comments »

Just a quick note, as I could not find a satisfactory answer fast enough googling the web. I got a (not so) nice __PHP_Incomplete_Class Object notice the other day, happily programming until that moment. Such a notice indicates that somewhere (very likely in your session) a class has been unserialized that php does not know how to handle. This means that php knows which class the unserialized data should be, but cannot find the class declaration. It may happen using this type of code:

class SomeClass { ... }
$_SESSION['some_instance']; // which is a SomeClass assigned in some previous request

Depending on the implementation of the class, e.g. use of SPL, this will result in a __PHP_Incomplete_Class Object. To fix this, tell php what the class is/can do before unserializing, i.e. move session_start below the class declaration.

MySQL Substr count

Posted: July 17th, 2009 | Author: | Filed under: MySQL | 1 Comment »

Recently I needed to create an SQL statement which was to count the occurences of a character inside a particular database field. For example, you could store the tags connected to a single db-record in a semi-colon (;) separated column in the record. To get the number of tags for this record straight from the database, we would thus like the number of semi-colons in the field (+1) as an indicator for this count. Since MySQL5 does not have a standard function for this (similar to PHP’s substr_count()), I had to find something of my own. Read the rest of this entry »

WordPress: Add more than one sidebar

Posted: July 10th, 2009 | Author: | Filed under: Wordpress | 1 Comment »

In wordpress it is possible to create multiple ‘sidebars’ with widgets on custom places in your template. To register a new sidebar open functions.php in your template folder (or create one), add:

if ( function_exists('register_sidebar') )
        'name' => 'SIDEBARNAME',
        'before_widget' => '',
        'after_widget' => '',
        'before_title' => '',
        'after_title' => '',

Explaination of the array() :

‘name’ = name of your new sidebar
‘before_widget’ = Add a html element before you start your widget (eg. <div class=”widget”)
‘after_widget’ = close the element you started above
‘before_title’ = Add a html element before your widget title (eg. <h3>)
‘after_title’ = close the element you started above

Now al you have to do is add your new sidebar to your place in your template, add:

<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('SIDEBARNAME') ) : ?>

This is what shows when no widgets are added.

<?php endif; ?>

WordPress: text-align fix

Posted: July 10th, 2009 | Author: | Filed under: CSS, Wordpress | Comments Off on WordPress: text-align fix

I just finished my new template and I was ready to test how it looks, great! but…oops a problem showed up and I couldn’t find what was wrong. Read the rest of this entry »