Introduction to Drupal

— with mparker17

Follow along at mparker17.github.io/talk–drupal-intro

Who am I?

mparker17 on Drupal.org, Github, and Gitlab

I work for Digital Echidna, Brady’s Meat & Deli

(previously Environment Canada, Versabanq, UWaterloo, PeaceWorks, Myplanet, OpenConcept)

I am an Acquia Certified Drupal Developer

CS degree not completed at UWaterloo

Goal and Objectives

This session will provide you with the knowledge you need to build a Drupal website using pre-built components and work on a Drupal website with others.

At the end of the session, you will:

How the web works

(In two minutes)

Getting the message

Server-s you right!

Questions?

(don’t sweat the details)

Content management systems

Content-ing yourself with the basics

Dru-pal’s your pal!

I use a CMS called Drupal because:

Drupal is awesome, but it’s not perfect. Some common complaints are:

Questions?

We’ll be installing Drupal so you can play around with it next.

Running Drupal

Get out your computers!

How a server stacks up

You can run Drupal on any computer running these programs:

  1. Apache HTTP server — A program that listens for web browsers and responds to them by sending either:
    • a file from the server’s hard drive, or
    • the output from a program.
  2. PHP — A programming language designed for generating HTML on the fly.
    • The PHP program echos everything it’s sent, except the sections of a file between <?php and ?>, which it treats as instructions.
  3. MySQL — A program to quickly and easily store and retrieve data.

AMPed up

It’s actually pretty easy to set up because there are tools that bundle these programs together:

Once your AMP stack is installed and running, test it out going to http://localhost:8080/ (MAMP), http://localhost:8082/ (Acquia Dev Desktop) or http://localhost/ (Linux) in a web browser.

Quick review

  1. Apache, MySQL and PHP were just installed on your computer.
  2. Windows and Mac users got a nice control panel to turn them on and off.
  3. When turned on, Apache will serve the contents of a folder on your hard drive…
    • Macintosh: /Applications/MAMP/htdocs
    • Windows: %HOMEPATH%\Sites\acquia-drupal
    • Linux: /var/www

The folder that Apache serves is called your webroot.

Questions before we move on?

(Data) Base camp

Drupal stores content and settings in a database. We’ll need to set one up before we set up Drupal.

  1. Start phpMyAdmin:
    • Windows: In the Acquia Dev Desktop control panel, click the Manage my database button. A browser will launch with phpMyAdmin in it.
    • Macintosh: In the MAMP control panel, click the Open start page button. A browser will launch with the MAMP start page. Click phpMyAdmin in the header.
    • Linux: sudo apt-get install phpmyadmin. In a web browser, go to http://localhost/phpmyadmin.
  2. Click Users at the top of the screen.
  3. Click Add user.
  4. Under Login Information, enter a short alphanumeric username, set Host to localhost, enter and retype a password. Take note of these credentials! Since they’re on your local machine, they don’t have to be secure.
  5. Under Database for user, click Create database with same name and grant all privileges.*
  6. Click the Add user button at the bottom.

This sets up a database with the same name as the username.

Installing Drupal

  1. Download the latest version of Drupal 7 from drupal.org/project/drupal,
  2. unpack the ZIP-file / tarball,
  3. put the extracted files at your webroot (don’t forget the .htaccess file!),
  4. go to http://localhost/install.php:
    1. On the Choose profile page, choose Standard.
    2. On the Choose language page, choose English (unless you prefer another language - in that case, follow the directions).
    3. Hopefully you’ll skip the Verify requirements stage. If not, ask for help from our trained technicians!
    4. On the Set up database step, enter the database name, username and password you entered when setting up the database. Leave the Advanced options alone.
    5. Drupal will take a few seconds to Install [the] profile you selected in the first step.
    6. On the Configure site step, enter a site name and e-mail address. Set up a Maintenence account with the username admin and the password admin (change these for your real site!). Enter other information as appropriate.
    7. On the Finished step, follow the link to your new site!

Questions?

Next, we’ll create our own movie-raiting website, similar to IMDB.

Drupal building blocks

Modules, themes, users, content types, menus, taxonomy, blocks and views.

Modular Bells

Theme songs

User your time wisely

Role playing

Permission to come aboard?

The documentation page on Drupal.org, showing that the header, sidebars, footers, tabs and menus are not content.

Learning to type

Field trip!

The path of least resistance

Aside: Alias security risks

Be careful what aliases you set up in the root of the site!

It’s raining menus!

A higher taxonomy bracket

A screenshot of a page on the Drupal website highlighting regions and blocks

Block party

A View-tiful Mind

Views lets you make lists of things.

Questions?

Next, we’ll talk about working on your shiny new site with your friends.

Collaborating

Database dumps, git and features

Storage lockers

Down in the dumps

Writing the contents of a database to a file is called making a database dump.

To do this:

  1. Go to phpMyAdmin.
  2. Click the name of the Drupal database in the column at the left.
  3. Click the Export tab at the top.
  4. Set Export method to Quick and Format to SQL, and click Go.
  5. The database will download to your computer.
    • Remember: your username and password are stored in the database, so be very careful how you distribute database dumps!

Import-ant notes

If you want to use a database dump, you must put it back into your database.

To do this:

  1. Go to phpMyAdmin.
  2. Click the name of the Drupal database in the column at the left.
  3. Click the Import tab at the top.
  4. Under File to import, choose the database dump you want to import, and click Go.

If you run into failed imports, try deleting (dropping) everything in your database before importing.

Git outta here

Bonus features

Questions?

Only one more thing before you can get back to working on your projects…

Drush

The DRUpal SHell.

Drush hour

Questions and discussion

This session should have provided you with the knowledge you need to build a Drupal website using pre-built components and work on a Drupal website with others.

You should now:

Find me at drupal.org/u/mparker17mparker17 on GitHubmparker17 on GitLab.