Looking back, if I’d known what I was getting into, I never would have started developing my new site in Drupal. But I got there in the end, and my mental health is frayed but still approximately intact.
Some of the terms I had never heard of when I started included CMS, CSS, PHP and MySQL. To pay it forward, I thought I’d share with you a few things that were SO not obvious to me, and which took me an unreasonably long time to figure out.
Bear in mind that I’m still totally technically incompetent, so do read any comments that appear below this post, as they’ll surely be pointing out all kinds of grotesque errors…
1. What the heck is this Drupal thing anyway? OK, so my best understanding of this is that it’s a little software package. It’s written in a language called PHP. It’s made up of core modules which you can download from http://drupal.org/project/drupal, and a bunch of optional (or “contributed”) modules, which you can surf at http://drupal.org/project/modules. All of this then sits around in a little set of folders.
2. Where does my Drupal installation live? Well, if your first step has been to download Drupal to your computer, it won’t be able to work there. It likes to live on a server, not on your computer at home. In the future, when you’ve developed your new site a bit, you’ll want to put it on the internet, and your Drupal installation will sit on your server in a little folder. That’s where it’s happiest. In the beginning though, if you’re going to build your site on your computer at home, you’ll need to download a pretend server environment, like Dev Desktop from Acquia, http://www.acquia.com/downloads, that will let you run Drupal on your computer.
3. Note that you don’t need to know anything about PHP to build a site in Drupal. When you search (preferably on Google) for a solution to your latest Drupal problem, a lot of the pages that come up will be providing snippets of PHP code. This is not the correct help information for you, the Drupal newbie. This is for technically competent people who are able to build their own modules and stuff like that. If you look at the other pages thrown up by your search, you will probably find an answer to your problem which involves working within the existing Drupal core and modules. That means, a solution you can implement using menus and tickboxes and whatnot, without needing to mess around with code.
4. Be careful where you put your optional modules and themes. Within the folders of your Drupal installation, there is a folder called ‘modules’ and one called ‘themes.’ These are NOT where you should put any contributed modules and themes that you add to your core installation. These folders are just for the core modules and themes. The folders you should use are a second set also called modules and themes, which sit within the ‘sites’ folder in your Drupal installation. (To make matters more confusing, if you use Dev Desktop it puts your whole Drupal installation into a folder called ‘sites.’ You need to drill down further a couple of layers to the other ‘sites’ folder. Sigh.) The reason all this matters is because you don’t want to mess around with the core Drupal installation (“Never Hack Core”). This is because the core will need updating from time to time (when security updates are issued), and you will have made life quite a bit more difficult for yourself if you have jumbled up the core and non-core stuff. You would be at risk of losing bits of your non-core stuff, that you worked hard to put in place.
5. The content of your site does not live in your Drupal installation. It lives in a MySQL database which is managed by your Drupal installation. This database will sit somewhere on your server, as determined by your web host. (As an aside, I never did figure out where Dev Desktop puts the database on your computer at home. It’s a mystery.) Anyhow, the exception to this is that the images within your site do live in your Drupal installation, they are in the sites folder somewhere (depending on your settings), with Drupal keeping records of them in the database. So, if and when you want to transfer your Drupal installation and your site from one place to another (like, from your computer at home to the server of your web host), you can copy/zip/etc the Drupal installation (including the image files) like any other set of folders. The database you can export either using the Drupal module http://drupal.org/project/backup_migrate or an application which works with MySQL databases like http://www.phpmyadmin.net/home_page/index.php, installed on the same server as your database.
6. How to log into your site in maintenance mode. If you put your site into maintenance mode (using the configuration page of the admin section of your site), it will not be accessible to internet users who are not logged into the site. This is handy to keep it hidden while you’re still developing it. If you go ahead and log out of the site, however, it will not be accessible to you either. Ooops! The solution is to go to www.nameofyoursite.com/user/login. Then you can log back in.
7. Which modules to use? There are a lot of modules, lots of them doing similar or related things. You want to try not to have too many modules, because they each slow things down a little bit, and because you'll have to maintain them (by installing updates as they are issued). http://drupalmodules.com has reviews. To help you assess the health and life expectancy of a module, look, on the module's project page, to see how many people are using it (at the bottom of the page). Look at the top right to see how recently people have been committing to maintaining it. Look at the bottom right for links to related modules. Check if the module you want is available for the version of Drupal you are using. Versions of the module that end in things like .dev and .beta are still in development and may have bugs. By the way, to add a new module to your site, it is not enough to put the modules’ files in (the correct folder in) your Drupal installation. You also have to open your site, go to the modules page in the admin section, and enable the new module.
8. Which theme to use? http://themegarden.org/drupal6/ is a good place to browse through themes. You may find one that suits you, and is available for the version of Drupal you are using, without any tailoring. In which case, great! If you want to amend one though, it seems like it is often very hard work to start altering a contributed theme. You may be better of using one of the themes that are actually designed for you to tailor them, like http://drupal.org/project/zen or http://drupal.org/project/adaptivetheme. When you turn one of these themes on (by selecting them as default within the appearance page of the admin section of your site), your site will suddenly look terrible. All bald and ugly. This is because these themes are designed for you to add all your own styling. You do this by creating a subtheme to sit beneath this base theme, and then creating/editing the CSS of your new subtheme. You may be able to copy and paste some or all of the CSS from another contributed theme that you like, as a starting point. Check the intellectual property rights before copying. This site http://www.w3schools.com/cssref/default.asp is a key reference source for creating or editing CSS.
9. You can type content straight into a block. Now, maybe you’ll find this dead obvious, but I’d been working for several months with Drupal before I realized that. As well as creating blocks with Drupal, you can also click ‘add block’ on the blocks page, and just type whatever text you like into your new block.
10. How to link from one node to another. If you want to put a link into the body (the main text) of your node (or another field in the node), unless you’re using a WYSYWYG editor, you’ll need to type the link in HTML. If you were linking to a separate website, the HTML might look like this
<a href= "http://www.amazon.com">click here to go to amazon</a>. You could do something similar for links within your website, but it would slow things down. It is more efficient to look at the URL of the page you are linking to, strip out the http and the www and the name of your site, and do something like
<a href="blog">Blogs</a> or
<a href="forum">Forum</a> or
<a href="content/jessicas-article">Jessica’s article</a> or
<a href="node/20">Jessica’s article</a> (where 20 is the nid).
<a href="/">Home</a> will link to the front page of your site.
<a href="node/add">Create page</a> will link to the add node page. To use an image as the link, do something like
<a href="node/20"><IMG SRC="sites/default/files/SmallBizTribe-logo.gif"></a>. Depending on the address of the page you are linking FROM, you may need to add ../ or even ../../ at the start of the destination address to push the address back up a level, for example
<a href="../user/jessica-kennedy">Click here</a>. Meanwhile note that you will need to have selected Full HTML or Filtered HTML as the text format for this text, or you’ll just see what you’ve typed, rather than a link.
11. How to see the NID of a node. If the node is in ‘edit’ mode, you can see the nid in the URL. (A node, in case you’re wondering, is a page like an article or a forum posting. You can design what fields it has and how they is displayed. Typically a node will consist of a heading, some body text, maybe an image, etc. Drupal assigns two URL addresses to each node, a human-friendly one made of words, and a nid, or node id.)
12. How to add hover text to a link. Within the HTML of your link, put TITLE=”Words you want to see in the hover”, for example
<a href="../blog" TITLE="More blog posts" >more</a>.
Oops, that’s 12 rather than 10. Oh well.
Blessings, and stress-free Drupal development, upon you all.
What life's really like when you work for yourself