Converting the Default URL Separator to Dashes in Lemonstand

Posted June 1st, 2010 in Database, Lemonstand, PHP by Flynsarmy

When it comes to online shopping carts, LemonStand is the hot new thing. Still in beta, this piece of software boasts a surprisingly large feature set and high level of customization options usually only seen in much larger CMS’s. The one narking issue I’ve had with it so far is its choice of URL separator – preferring underscores over dashes. After speaking to the very polite and friendly developer behind LemonStand, a solution was quickly devised.

To convert the default URL separator in LemonStand from underscores to dashes simply add the following line of code to your config/config.php file.

	$CONFIG['URL_SEPARATOR'] = '-';

Update 3 Jun 2010: I’ve received word from the author behind LemonStand that he’ll be publishing an update later today changing the default URL separator from underscores to dashes. The change will not affect any existing installations and only apply to new installations. For developers wishing to change the default separator on new pages on existing installations, the fix above still applies. This is great news that I’m sure many developers out there will be pleased with.

Read More »

@Font-Face Windows Woes

Posted May 29th, 2010 in Uncategorized by Flynsarmy

Let me preface this post by stating that I have the design talent of the average developer – that is to say: none. So when I decided to start learning about CSS3 @font-face I thought I was going to be in for a night of pain; boy was I right.

The post headings on site are rendered in the Museo font using Cufon. Cufon is an amazing piece of JavaScript that allows you to embed fonts into webpages making them visible in all browsers. It works as advertised, however it has a habit of causing pains for visitors on slower connections. For this site, the cufon script is 17.8KB and Museo font package is an added 190.4KB – a hefty download. At this point, the developer in me would declare the benefits not to be worth the drawbacks and scrap it all together. Luckily for all of you though, I’m constantly surrounded by talented designers, namely That Stevens Guy and begrudgingly blindly follow what they tell me to do in that department. So cufon has stayed. Is there a better solution though? Meet @font-face.

Read More »

CSS-Only Tabs (No Javascript)

Posted May 28th, 2010 in Javascript by Flynsarmy

Recently while randomly browsing I came across a method of displaying multiple tabs using only HTML and CSS (see here for the explanation or here for an amazing demo). This presented an interesting concept – tabs with no JavaScript. There are quite a few drawbacks but in the right conditions this could be a good addition to your site.

Read More »

Remove JQuery from WordPress Frontend

Posted May 27th, 2010 in Javascript, PHP by Flynsarmy

Earlier tonight I wanted to remove the ancient version of JQuery automatically loaded on the WordPress front end and replace it with the much speedier latest version (currently 1.4.2). This turned out to be more difficult than planned, however after a bit of scrounging I found the solution; add the following code to your template’s functions.php file:

if( !is_admin() )
{
	wp_deregister_script('jquery');
	//Add latest JQuery back into header. Comment this line out to remove JQuery alltogether
	wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"), false, '1.4.2');
	wp_enqueue_script('jquery');
}

Enjoy your blazingly fast JavaScript experience :)

Read More »

PHP Web Socket Chat Application

Posted May 26th, 2010 in Javascript, PHP by Flynsarmy

UPDATE 15 Feb 2012: This post is woefully out of date. See my new PHP WebSocket Chat Application 2.0 post for a working tutorial compatible with the latest WebSocket spec as of Feb 15, 2012.

Today I’ll be doing an in-depth tutorial on how to create a simple, real-time chat application with HTML5 web sockets.

Disclaimer: Due to the relative infancy of web socket technology, this tutorial will currently only work on Google Chrome and the spec isn’t finalized yet so it may break in the future (specifically during the handshake phase).

UPDATE Nov 14, 2010: Since the writing of this post, the handshake spec has changed in such a way that browsers requiring the new spec will return the error code INVALID_STATE_ERR upon connection. I checked the PHPWebSocket page for an updated version but it looks like the developer hasn’t released one yet so instead I now recommend using Bohuco’s excellent websocket script instead.

Read More »

Get Notification on Website Visit

Posted April 1st, 2010 in Linux, PHP, Python by Flynsarmy

This tutorial will show *nix users how to get a nice notification displaying on their screen when people visit their site using a PHP and a Python script. This isn’t practical for sites with large numbers of visitors but it’s great for people running small sites on their local machines.

Read More »

Installing BackendPro on Multi-Site CodeIgniter

Posted March 4th, 2010 in PHP by Flynsarmy

Out of the box, CodeIgniter only supports MVC. This tutorial explains how to add HMVC to CodeIgniter by installing BackendPro 0.6.1 into a Multi-Site CodeIgniter 1.7.2 installation for some nice, modular goodness.

Read More »

Integrating Doctrine Into WordPress

Posted February 28th, 2010 in Database, PHP by Flynsarmy

WordPress is great on its own but if you want to do alot of database work with it you’ll quickly realize how frustratingly limited the wpdb class is. In this tutorial I’ll show how to integrate Doctrine into WordPress through the use of a plugin and make your developing life so much easier.

Read More »

PHP – Including All Files in a Directory

Posted February 28th, 2010 in PHP by Flynsarmy

Including every file in a specific directory automatically is a useful way of auto-loading classes in PHP. This could be done manually of course but we’re developers and we’re lazy so here’s a better solution utilizing PHP’s glob() function:

<?php
	foreach( glob(dirname(__FILE__) . '/classes/*.php') as $class_path )
		require_once( $class_path );

In this script, glob() searches for all pathnames matching the given pattern (In this case all files with a .php extension in the ‘classes/’ directory). Please note that if glob() doesn’t find any matches it will return false instead of the expected array, so unless you’re iterating over its results with a function that checks for this – such as foreach – either typecast or perform some other form of validation before use. You’ve been warned.

UPDATE 15 May 2010: Found this informative article related to the various ways of loading all files in a directory and their respective speeds – performance matters, people!.

Read More »

Importing/Exporting CSV files with MySQL

Posted February 27th, 2010 in Database by Flynsarmy

A common request with MySQL is to import/export CSV files. CSVs are merely delimited text files and so this is relatively easy to accomplish. To import we’ll be using a LOAD DATA query and for exporting the mysqldump tool bundled with MySQL. We’ll be delimiting our CSV with commas and enclosing each field with double quotation marks.

Read More »

Page 10 of 11« First...7891011