David Slack - Web developer

Subscribe to RSS - Drupal

Drupal

About David Slack - Web developer

Hi, My name is David Slack and I'm a Web Developer. I've been creating, updating, designing and developing websites for over 15 years and I'm using this website to show what I'm up to at the moment.

I'm going to add some bits that are useful to me to the site and some of it may be helpful to others so have a look through the Information section to see if there is any useful stuff. Also, if you have anything that might be useful to me (or others) don't hesitate to contact me or leave a comment on the relevant page.

e-Commerce in Drupal

Well, I've got to say it, the Drupal / e-commerce solutions are not great!

Scripts, modules, apps, programs, snippets, plugins, etc

There are many scripts I create everyday in many different languages and I'll try to keep them all here for reference.

At the moment I use Javascript, php and html to create most of my scripts but I might add in C++, CSS, Pearl or any number of other languages to these pages at any time. Most of the bits you will find on these pages will be Drupal themes or modules,  jQuery plugins or php scripts.

I'll try to keep this all as up-to-date as possible and try to keep things as free from bugs as I can but please let me know if you have any problems.

mod_security and Datflame

I use a really good hosting company called Dataflame but they suffer (as most hosts do) with problems helping thier clients.

mod_security and Drupal 7

Main image

The story

I'd been working on a website (http://luckyfingers.co.uk/) for a few hours when the site died for no apparent reason. It was late so I left it for next time. I went on the site a couple of days later and all seemed fine until I installed a module on Drupal 7, at that point the site went off!

I checked in the browsers and it was gone, then tried to access the files via ftp and the server was gone.

php.ini

Some of the problems on a website are down to the server or the server host provider being stingy with the memory. For a Drupal website for the image handling and other bits you want at least 128m of RAM, but some hosts limit you to much less (1and1 only give you 30m in some cases.

To combat this - and some other issues - we create a php.ini file in the public_html (or other root) folder and add the following:

memory_limit = 256M
safe_mode = off
session.cache_limiter = nocache
open_basedir = none
extension = pdo.so
extension = pdo_mysql.so

 

My website

Around 10 years ago I decided I needed a place to test my code, so I created a sub-domain on a server I had for a company I was working for. I then tested DHTML, javascript and other bits on it.

Arm & Eye

The Arm & Eye website was created using Drupal 6 using a design from 

Senua Hydroponics

Main image

Senua Hydroponics has gone live!! Its a site selling hydrponics (greenhouse) stuff.

I've been creating it for the last few months sorting the design, creation and most of the content. It's create using Drupal, Ubercart and lots of other modules, I've also created a theme for it from scratch and created a few modules from scratch.

Drupal 6 Clone

For the last 2 hours I've been trying to clone a Drupal website. I have a site on my PC (WAMP) and some server space on a dedicated server.

Now, I uploaded all the files without incident, next came the database. Usually I'll upload using phpMyAdmin but if there is a problem I'll upload using SSH.

PHP Fog

Just found out about PHP fog from Ian. It's a cloud based php hosting for php developers. I had Drupal 6 installed in a few clicks!

I've found it supports:

  • SSL
  • SSH
  • GIT
  • MySQL
  • Environment Variables

Not sure about online file management yet cos I've not had a good play with it.

Once they get emails and online file management shared hosting could be a thing of the past...

Act Maintenance Solutions

This is the second website of work from Bitopia and created with myself and Ian Gristock as developers working together.

Spam

All sites have the potential to grow very big, very fast and the bigger the site, the more spam your site will attract.

Your first defence against spam is to try and stop the automatic spamming by bots, this is done with a CAPTCHA. It creates an image with letters and numbers a bot cannot read so only humans can post to your site (well, that's the idea).

Senua Digital

This website is created using Drupal but is not the usual ecommerce site. The site is a place holder for products that will be created later with the Senua Digital brand.

SEM (Search Engine Marketing)

SEM or Search Engine Marketing is a way to get your website on to and up as high as posible on the search engines. You do this by link-backs and links.

Link-backs are links to and from your website so you link to a page on the web and they link back to you. Search engines pick up on this and move you up the rankings depending on how valid the link-back is (do the two sites/pages have info in common?) and also how valid the site is (is it a spamming forum or a .gov website?)

Drupal theme - Editing the files

Info

The first file we want to edit is the .info file so open the file in your editor. This file controls all the settings of the Theme and without it Drupal will not see your theme. Here are some of the things you can add:

Drupal theme - Create Folders and Files

First thing we need to do is create the folders for the theme in the correct places then create the files that are needed. So lets start with the main folder. There are a few places to put your theme but we will use the standard so as not to mess up any updates and make the theme easily movable.

We will use the design for Dodgey Daves Discount Emporium so make sure you have the Fireworks png to hand.

Creating a Drupal theme

So, we have a design in Fireworks and a website created with Drupal how do we bring the two together? We create a theme (called template in some systems) using our design and add it to our website.

What is a theme?

In Drupal, a theme is a group of files and folders all added together in one main folder to change the look and feel of a website. There are some files that are needed and some that are useful but in the end they create the look and feel for the whole site. Using a theme you can theme each page, each part of the site, just the home page or many other things.

Helpful Code

I'll add some code snippets here that could help with a drupal website.

PHP

Add a class to each page

NB: This is for your custom theme, DO NOT add to one of the Drupal themes eg Garland. If you want to add a class to each page add this to the <body> tag of page.tpl.php:

Pathauto

Pathauto is a module to make your website use the page title instead of the node name for the URL.

For example, you could have www.example.com/node/3 or www.example.com/content/about-us . What is more descriptive of the content the page contains? Drupal has tools built in to change the URL on each page but wouldn't it be easier for you and you client if this was automatic?

Enter Pathauto, you can now create page and not worry about the URL.

Drupal 6 payment gateways with Ubercart

Here is a list of all the payment gateways I could find for Drupal 6 and Ubercart. A guy on Drupal called dalleyasaurus has done the same type of thing here, but with no links.

SEO (Search Engine Optimisation)

SEO or Search Engine Optimisation is the black art of making your site easier for search engines to see and list. The better your SEO, the higher the site is ranked in the search engine. There are lots of ways of optimizing websites for search engines but here is how I do it.

Once you have the site optimised for Search engines you can start to market it with SEM and offline marketing.

Modules

As usual we need to add in some modules to extend the Drupal website. Lets start with these:

Displaying the Images

Now we need to tell the site how to display the files using our ImageCache presets. To do this click the 'Display fields' tab at the top. Now use the pull-downs to get the setting below

Images

  • Label = <Hidden>
  • Teaser = no styling
  • Full node = no styling

Main Image

ImageCache

Now to set up the main part of the image modules, we'll setup ImageCache

  1. Go to admin
  2. On the right hit 'ImageCache'

There will probably be only one preset for ImageCash at the moment and this is for the iTweak upload module. This preset will set up an images size for any image uploaded using iTweak upload. We won't touch this at the moment but we will create our own

From the image the user will upload we will create 4 images

Modules

First we'll download the modules for images:

Admin

The first thing your going to want to do is to check your admin page, on the left hand side is a link saying 'Administrator', click that. You can read all the info that goes with each item (and probably should) but for now we want to check everything on the installation is ok. Click hide descriptions at the top left to hide the descriptions. On the bottom left click Status report and look for anything in red or yellow. Any problems are usually due to folder permissions not being correct.

Multilingual (Drupal 6) Website

So you have a Drupal website and you want it multilingual? Easy! First you need to make sure your site is up-to-date, then install the correct modules, then translate away. Read on if this sounds like what you need.

You'll probably want to use a test server for this

eCommerce (Drupal and Ubercart) Website

There are a few ways of creating a website with eCommerce, my choice is Drupal 6 and Ubercart

CMS (Drupal 6) Website

So you've chosen to use Drupal as your CMS of choice for your new website? Read on to find out how to create a basic CMS website. From here we will go on to add user profiles, blogs and other social aspects like Facebook, MySpace or twitter. We will then go on to add translation to the site and finally add eCommerce.

Pages

Latest content

There are lots of developers out there with varying degrees of experience and expertise, some mid level, some junior and some senior. Some...
First thoughts are Symfony is ace!Only been using Symfony for 1 project but the amount of coding it has saved has been worth the time spent...
The Lost and Found website was built by myself (David Slack) and designed by Arm & Eye.The site was created to promote a bar and...

Social networks

Contact me here or catch me on one of
the social networks below


What I'm listening to

My blog

Wednesday, 2 August, 2017 - 06:56
There are lots of developers out there with varying degrees of experience and expertise, some mid level, some junior and some senior. Some developers...
Tuesday, 5 March, 2013 - 09:49
First thoughts are Symfony is ace!Only been using Symfony for 1 project but the amount of coding it has saved has been worth the time spent learning...
Monday, 3 December, 2012 - 10:07
As a web developer and web designer I need to take into account everything on a site from SEO, marketing, usability across devices, the look and feel...

Recent comments

Try this on your mobile

Use your QR reader to read this

You should be able to use this right from the screen

Latest tweets

Calendar

M T W T F S S
 
 
 
 
 
1
 
2
 
3
 
4
 
5
 
6
 
7
 
8
 
9
 
10
 
11
 
12
 
13
 
14
 
15
 
16
 
17
 
18
 
19
 
20
 
21
 
22
 
23
 
24
 
25
 
26
 
27
 
28
 
29
 
30
 
31
 
 
 
 
 
 
 

You are here

Back to top

Copyright David Slack - Web developer