Bullet Proof CMS record ordering pattern

Posted in CSS, Code, PHP, cms, mysql

When building a custom backend, quite often a client will ask for the ablilty to order records/posts/images…

Here’s a tried and tested method i use to build this functionality. It will work with or without js. In this example we will order the traditional post records.

1. The Database

Create a table to hold your posts and include a column (int) called order.

2. Adding a new record

Each time a new post is saved, the order column is assigned the auto inc value of the rows id. This prevents records from ever having the same order value.

3. The order view (HTML)

To provide the user with a way to order posts records, i’ll start with the HTML. This process is designed to degrade gracefully when JS is disabled. Dont worry if this process seems a bit clunky to the user, chances are they’ll have js turned on. I have found by restricting yourself to develop for HTML first created better structured and semantic code. Quite often divining straight in there with the javascript will get the job done, but it’ll be a headache to maintain.
Read the rest of this entry »

No Comments »

Sync Web Dev with MAMP and Dropbox

Tags: , , , , ,
Posted in Hacks

dropbox and mamp

Dropbox

Initially I used dropbox, as an alternative to email, to share music tracks and ideas with band mates. So simple even our singer could work it out! It has quickly become my main tool for syncing all sorts of other data.

So I decided to see if it could be used to sync multiple MAMP web development environments. Site files and MySQL databases.

Read the rest of this entry »

16 Comments »

Winters coming, WrapUp!

Tags: , , , , , , ,
Posted in Code, CodeIgniter, PHP

I’ve been using this library, or iteration of, for about a year now and have finally had time to document it properly. WrapUp is a CodeIgniter Library to manage your sites <head> element.

Defining the doctype
Setting the page title
Adding meta data
Adding CSS
Addming Javascript files

This saves alot of time getting a site up and running. Its also extremly handy for large sites as you can define your default meta data, css & javascript in a __constructor so its is inhereted by all pages on the site.

A few examples of WrapUp can be found after the jump.

Read the rest of this entry »

2 Comments »

Oi, Mind your Messages

Tags: , , ,
Posted in Code, CodeIgniter, PHP

Often, I find I need to send notifications to the user (webpage) during server code. This may be a warning, notification, or a message that an action has hapend. If you’re using a MVC framework it’s not practical to exit running code or echo out the message. From a User Interface perspective it is also imperative that the user knows where to look for these notifications and what they mean.
Read the rest of this entry »

1 Comment »

CSS Typography Template

Tags: ,
Posted in CSS

typography-framed

Here’s a quick HTML template to organise your CSS typography.

Nothing fancy, just an HTML file containing the most common elements to start your CSS, and a basic typography stylesheet. I used the 960 grid system to reset browser CSS and control the template layout.

I find this helpful as a starting point for any site. Before I start knocking a CSS class together to style an element up for a specific page, I refer to the sites CSS template to see if  a similar base element already defined.

I would encourage keeping this typography stylesheet as basic as possible. Then use general css classes to add extra style later on.

Both the HTML and CSS files are included in the zip after the jump.

Read the rest of this entry »

No Comments »

Shortie v1.0 Released

Tags: , , ,
Posted in Code, CodeIgniter, PHP, Uncategorized

Recently I needed code to shorten URLS and tweet said url as a twitter update. This all needed to happen in their existing CMS built using Codeigniter.

Turns out the twitter part was easy, thanks to simonmaddox’s nice twitter CI library. I got a few whiffs of a url shortening CI library around the web, but it looks like the code was no longer available. Oh well, a good excuse to knock up a new library!

Read the rest of this entry »

No Comments »