Drupal is a popular open-source content management system (CMS) that can be used for all sorts of Web sites. If you are just getting started with Drupal development, you have most likely have come across some situations that you didn’t know how to handle. In this article, I will discuss some of the things you should become acquainted with or know how to handle so that you can become more proficient with Drupal. If you are looking for a more comprehensive learning, consider enrolling in one of LearnComputer’s Drupal training courses!
1. Secure User #1
User #1, typically the admin account, is the owner of the site and holds a lot of power over your Drupal installation. This is the account that you will need to use to keep the site up to date and perform administration tasks. Be sure to keep this account secure as it is an important part of your site.
2. How to Troubleshoot the “White Screen of Death”
If you browse to your Drupal site and get nothing but a white, blank screen, it usually means that Drupal has encountered a PHP error. This error, affectionately known as the “White Screen of Death” after Microsoft’s “Blue Screen of Death”, can be caused by a few different problems but typically is a development error. If you find yourself in this situation you will need to turn on PHP error reporting for your site so you can find where the problem is.
3. Back Up Your Database
It is recommended that you keep a backup of your database in a secure location just in case anything goes wrong with your site. This location should be separate from your Web site location, preferably on a different host or in your home back up system. You can use the Backup and Migrate module to back up the database and then move the file to a new location.
4. Dumping the Cache
When a page is requested in Drupal it is first served from the cache if one is available. This way, a page doesn’t have to be generated dynamically each time a request is made. The benefit of this is the reduction in SQL queries and server requests being made. However, if your site begins to act strangely or you can’t see theme edits during development, you can use the Flush Cache function to remove these cached files. The site will then rebuild itself with the up-to-date files from the server.
5. Understand User Roles and Permissions
When setting up users on your site you need to be able to understand the “roles” those users will have on the site and which permissions those users can have. In the permissions section under User management, you can configure user permissions. Here are the default Drupal roles:
- Anonymous user – User is not logged in
- Authenticated user – User is logged into their account on your site
- Admin user – User is logged into their account on your site that has administrative permissions
In the Permissions section, you can define what each role can and cannot do on your site to prevent users’ access areas or making changes to things they shouldn’t.
6. Understand Theme Development Concepts
While there are hundreds (if not thousands) of themes available for free or paid download, you may want to create your own custom theme. It is recommended to use a modified version of the Framework Theme as a base since it has all of the additional graphic elements such as background, icons, logos etc…and the CSS stylesheet. A theme is made up of the following files:
*.info– This file contains information about the different regions on the page. If you are adding a new area to your page, such as a footer, you would put it in here.
page.tpl.php– This is the default template for pages
node.tpl.php– This is the default template for a specific node. Custom nodes can be created by creating a file with the naming convention: node-[nodename].tpl.php
template.php-This file pulls the layout together and calls the different functions needed to create the layout for each page
style.css– The custom stylesheet for the site
7. Setting Up Clear URLs
In Drupal, by default, the system uses an unfriendly way of creating URLs to your web pages, such as http://mysite.com/?q=node/1 which is impossible to use as a direct link and some search engine crawlers will not index these pages. To create better URLs that are more user-friendly and SEO-friendly you need to turn on clean URLs. To do this, go to Administer -> Site configuration -> Clean URLs
8. Deploy a Contact Form
Most site owners want a contact form as a way for user’s to give site feedback or to contact them. In the Drupal core, there is a pre-built contact form that you can enable and edit before deploying your site. To enable the contact form, first enable the Contact module, which is an optional core module. Then you can go to Administer -> Site Building -> Contact Form.
Now you have the basic contact form. You will most likely want to make edits and changes, such as adding categories, new fields and other information. You can even have the contact form email different addresses based on the category selected, which can be very useful.
9. Using Views
Using views gives you a greater amount of control over the process of creating displays of your information. In the Views editor, you can filter your available nodes and publish them in tables, grids, lists, etc… as well as sort them. For example, you could use Views to specify any of the following:
- A alphabetical list by name and phone number in the Contact page
- A grid of pictures for the Products page
- A list of e-mail addresses and phone numbers for an internal contact list
Views are a practical way to display information in different ways that you may want to use around your site. Instead of having to create these lists, grids and other things by hand, learn to love Views.
10. Creating a Launch Checklist
After you have configured your site, gotten everything ready and fine-tuned your theme it is time to launch your finished site. Here is a checklist of some things to do:
- Setup a Cron Job – You may need your hosting provider to help you set up a cron job. Drupal’s default script is located at /cron.php
- Rewrite .htaccess -Make sure you have setup your permissions to your folders correctly in your .htaccess file. You would also want to setup a friendly redirect from yoursite.com to www.yoursite.com to avoid being double listed (and thus penalized) by search engine crawlers.
- Setup the Performance Caching-Your site may benefit from having caching turned on, which can improve page response times. Use the caching function to reduce calls to the database and create less demand on your server. You can find it in Admin -> Site configuration -> Performance
When you are first getting into Drupal there are a lot of things you have to learn before you become accustomed. It is recommended that if you are creating Drupal sites for a customer, to find out what types of functions you are most likely to use or that match what your client is asking for, and then find a set of modules that are well-supported to use in your toolkit for deploying Drupal sites. As you learn more about Drupal you will begin to become more proficient with the system and be able to move on to more advanced topics.