Pages

Wednesday 29 August 2012

Drupal Website Building Tips - Part 1


Introduction

Drupal is one of the most widely used website servers in the world. It is even used by the US White House. It is free and open source and can be customised to many different uses by installing additional modules. This page is a cookbook of how I set up a Drupal site and may be helpful for getting an initial site customized. I am assuming you have one (or multiple) Drupal installations running using these instructions.

Initial user setup

  • It is not a good idea to give anonymous users access to the site or create accounts until you have the site completely set up and are ready to publish. There are people trolling the web looking for new setups, who will create an account and start installing modules faster than you can. Turn off anonymous user accounts:
Drupal -> Administer -> User management -> User settings -> Only site administrators can create new user accounts.
  • Create an administrator user role:
Drupal -> Administer -> User management -> Roles -> Add role -> administrator -> edit permissions -> check all
  • Create a new user who will be an administrator
Drupal -> Administer -> User management -> Users -> Add user -> Adminuser -> roles -> administrator
Use this user as your everyday administrator, saving the user you created at installation as the superuser

Create a Welcome page

  • Create a Welcome page:
Drupal -> Create content -> Page
You can choose where the display will end by adding the tag at the end:
<!--break-->
Note: If you don't put this tag at the end, the display of the page (known as the "teaser") will be truncated to 300 characters by default. This behavior can be changed:
Drupal -> Administer -> Content management -> Post Settings -> Length of trimmed posts: Unlimited

Change your default logo

  • The ideal size for a logo is about 110 x 100 pixels. A transparent background for the logo is desirable. (You can use Gimp to create an alpha transparency layer for any photo. See theseinstructions.) You can use Gimp or Gwenview to resize the image.
  • The default logo is specific to the Theme you are using. If you are using the default Garland theme, for example, change the logo:
Drupal -> Administer -> Themes -> Garland -> configure -> Logo image settings -> Use the default logo: unticked ->
Upload logo image: your_own_customised_logo.png

Create a new menu in the left sidebar

When most users create new content (such as a Page or Story), they place it in the Primary Links or Secondary Links menus. At installation, Primary Links and Secondary Links appear at the top of the page, which looks nice. But what if you want a new menu, that appears (for example) only on the left sidebar?
  • Create a new menu:
Drupal -> Administer -> Site building -> Menus -> Add menu ->
Menu name: mynewmenu -> Title: My New Menu -> Description: This is a custom menu I created. ->
  • Place the new menu in the left sidebar:
Drupal -> Administer -> Site building -> Blocks -> Disabled ->
My New Menu -> Left sidebar -> Save blocks
  • Add items to the menu (these can be external links or links to internal pages):
Drupal -> Administer -> Site building -> Menus ->
My New Menu -> Add item
Note that you can also create new content and add it to this new menu at any time.

Increase PHP memory

  • Increase PHP memory (or you will get a "memory exhausted" error). (Use the gedit text editor instead of kate if using Ubuntu instead of Kubuntu.):
sudo kate /etc/drupal/6/sites/mysite_x/settings.php
Add this line at the end:
ini_set('memory_limit', '96M');
I used to use 32M, but 96M helps with graphics.

Increase uploaded file size limits

The PHP scripting language is used for uploads. Absolute upload limits for the Apache webserver are set in a PHP configuration file and must be changed there.
  • Your uploads are probably larger than the default upload limits of PHP (set at 2 Mb, or "2M", by default), so we will need to increase those. In the example below, I will change the upload limit to 100 Mb ("100M"). Two parameters must be changed in the php.ini configuration file in /etc/php5/apache2 (use the gedit text editor instead of kate if using Ubuntu instead of Kubuntu):
cd /etc/php5/apache2
sudo kate php.ini
  • Change:
post_max_size = 8M
to
post_max_size = 100M
  • Change:
upload_max_filesize = 2M
to
upload_max_filesize = 100M
  • Save the file and restart apache2:
sudo /etc/init.d/apache2 restart


No comments:

Post a Comment