Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Technically speaking Drupal is a front-end display system for a back-end database. Throughout this course, we are going to be looking at the data as it resides in a MySQL database, which is the most common one to use with Drupal. You can manipulate that database in many ways such as, for example, through a command line interface or a platform specific SQL program, but we are going to use the web-base phpMyAdmin program that's included with both WAMP for Windows and MAMP for Mac and you have probably installed it to get Drupal running on your computer. I should mention that the database doesn't have to be MySQL. It could be PostgreSQL or Microsoft IIS and when Drupal 7 appears in late 2009 or early 2010, those database options will expand enormously.
But for now, we are going to look once again at MySQL using phpMyAdmin. We are assuming that you already have Drupal up in running. All you need is the basic Drupal installation. You can learn how to install Drupal in the series Drupal Essential Training also from lynda.com. I also want to mention that whenever you use the exercise files or with this course on a disc the username is admin, a-d-m-i-n and the password is booth, b-o-o-t-h. Let's not talk about the database specifically but rather how to get data into it. There are basically four ways. The first way is through Drupal itself. This is the method that you undoubtedly already know and I'll show you how to do it now. Here we have our basic Drupal installation we have just created it.
To create content it's very simple. We go over to Create content. Click on the link. We are going to create a page, so we click on Page and fill in the form. I'm going to make this say "Hello, world!" "It's good to be here!" Scroll down to the bottom. I usually check my Publishing options and let's make this Promoted to the front page and say Save. Good. Now if we go back to our homepage, we see that there is our note that we have just created and if we click on it we could then go back and change it. Again, this is the simplest and most straightforward way of getting information into Drupal.
The problem with it is obviously you can only do one thing at a time. So we are also going to talk about some ways of bringing in a lot of information that you have in another system. One of those ways of bringing in more than one piece of information at once is by putting it directly in the database using phpMyAdmin or some other SQL program. This is something you should only do if you are absolutely sure that you know what you are doing and even then experience Drupal developers cringe when they see someone putting in data directly into the database because it bypasses Drupal's stability and security processes and the chances are very, very high that you will completely break your installation this way.
Don't worry! We'll show you a couple of better ways in a minute, but there are times when a quick and dirty SQL command is safe and convenient, so it's good to know that it's possible. To insert data using phpMyAdmin, you would first go to the program, click on your database in this case it's called "lynda" and find the table that you want to insert data into. Let's just pretend that we are going to insert something into role. We want to add a new kind of user role. Our browser just sees what's there and you see the two that are already built into Drupal, the anonymous user and the authenticated user.
If we wanted to add a role, we could do so using this Insert command or using the SQL command and then typing in the SQL command that was necessary to add or change a role there. Again this is very dangerous to do and I would only recommend changing information in the database if you really know what you are doing. So let's move on to a third method. You could also get information into Drupal using Drupal's API that's the Application Programming Interface. You would create a program usually in PHP that would talk to Drupal in the way that Drupal is used to. Now I have to admit, a few months ago I spent a week writing a big data import project using just SQL. I knew it was possible to do by writing a PHP program, but I'm not a programmer and I only know the smallest amount of PHP programming language. So I brought in all this data using SQL and I ran into all sorts of problems because as I say, bringing data and using SQL is not as easy as it sounds. There's a lot of dependencies within Drupal that only become clear if you bring the data in using one of the ways that Drupal understands and then it all works.
However, I was fortunate to find an article online written by somebody at the company Acquia and here it is, Migrating the Drupal way. It's a series and right now as I speak there's four parts of the series, but more maybe coming. But in the first part, if you scroll down a bit, it explains exactly how you can write such a program and gives you the code for a simple program to create a note. This is excellent if you already have a large database full of information that you need to bring into Drupal. Just find a way to export that data so that it fits into this program and bring it in one big PHP file. If you want to do more with Drupal's API, there are several resources that will help you.
The first one is this contributor's guide which you will find it contributors-guide on the Drupal.org website. It explains some of the procedures and thus practices for programming in Drupal and the links here will help you a great deal. Possibly the most important link there is to the Drupal API itself. The Drupal API is located at api.drupal.org. Here you will find a list of all of the commands that Drupal understands natively. These commands will let you program Drupal in way that it understands. As they say in the community, "It's the Drupal way." Finally, there are numerous modules to help you move and change data in a Drupal site. Two of the biggest and best known are called node import and user import. These modules are always in flux. If you want to use a module, look through the import and export section on drupal.org module directory to see if there is one that fits your needs. You can find that directory by going to drupal.org, clicking on Modules and then scroll down into this group of categories here, until you see Import/ export. Click there. Make sure you filter according to whichever version of Drupal you are using, in our case that's 6, and there you have it. Now you have a long list of modules that you could look through and decide which is best for you.
When you are learning Drupal, it's easy to forget how it's used in the real world, where you are often creating a site from data that came some outside source like business records or even another content management system. Your data presentation is only as good as the data itself. I hope this video helps you to move that data into Drupal, so you can start making it look great.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 103149 Viewers
58 Video lessons · 55658 Viewers
61 Video lessons · 89816 Viewers
56 Video lessons · 104986 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.