A New Website, Part Six - Drupal Modules
The Front Page
Before getting started for today, I wanted to resolve something that had been annoying me. Ever since I installed Drupal, it has been showing me a list of things I need to to to get set up on the front page of my website. In earlier versions of Drupal, this was defined as a content block, which I could just delete. This time, however, it didn't show up anywhere.
I figured it must be put there by the software itself. On that theory, it would go away as soon as I created some real content. So I went into the 'Create Content' menu, selected 'Story', and typed 'Hello World'. Submitting this put it on to the front page - and eliminated the 'things to do' list.
But I'm still annoyed. The front page does not show up anywhere on the list of pages. This means that it, too, is generated by the system. I can get rid of it by replacing it - and by replacing it acquire the capacity to edit it. As it is now, the only way to manage content on the front page is through the block controls and the post settings. You have to select 'Site Configuration', then 'Site Information', and change the page at the bottom of the list of options (though you should actually create the new page first).
A module is some additional programming that gives your site some additional functionality. These programs interact with the main Drupal program and add blocks, content types, and any number of things. A number of optional modules come installed with the original Drupal download. In addition, you can get many more modules from the Drupal web site.
The first step, then, is to look at the list of modules that comes with the Drupal download. So I select 'Site Building' -> 'Modules'. The list of modules is before me; I'll explore them one by one and decide whether to activate them.
The Aggregator is an RSS aggregator. I will probably build my own aggregator for the site, but for now, it would be nice to have. So I activate the module.
When I activate the module, three things happened:
- a new link appears on my Administration menu in the left sidebar.
- some links appeared in my 'Administer' menu, under 'Content Control'
- 'Aggregator' also appears in the 'Access Controls' menu.
This will happen for every module. So after activating a module, you should click on the link in the Administration module to set it up, then go to Access Controls to make it available (if you want).
In the Administration menu I see 'RSS Aggregator'. Following this link, I see I can add a new category, add a new feed, or change the settings. If I add a category, then I can assign feeds to that category. The settings determine how many posts to display, how long to save old posts, and so on.
I create a category 'Me and Mine', and then create an RSS feed for OLDaily. I leave the settings on their default. Now, the aggregator should harvest OLDaily once an hour (in practice, I would make it once a day). However, it needs the crontab to be running. I haven't started the crontab, because I'm not in production yet.
A crontab is a way to run pograms you want to run automatically. Essentially, your web server computer will run any program listed in the crontab. You can set the crontab to run at certain intervals, sometimes as frequently as every second! Drupal has a crontab which should be run every hour. It updates the search index, among other things, and it runs any RSS harvests that need to be run.
I'll set the crontab later - it's another item to add to the todo list. In the meantime, I can update my RSS feed manually. I list the feeds, then click the 'Update' link beside OLDaily.
Um... uh oh. I have hit my first genuine bug in Drupal 5.0 beta: "Fatal error: Call to undefined function: xml_parser_create() in /home/downes/www/drupal/includes/unicode.inc on line 138" Heh. The aggregator works just fine in earlier versions of Drupal, but something chnaged. Let's see if I can fix the problem.
Here's the secret to handling bugs in software: copy a longish chunk of the error message, and paste it, in betwen quotation marks, into the Google search engine. be sure not to include anything specific to your installation (for example, I would not include 'drupal/downes'). I decide to search for 'unicode.inc on line 138'. Like this. Today, however, nothing shows up. Let's try 'Call to undefined function: xml_parser_create() '. Like this.
Here I got a bunch of links. So what's up? A lot of them are for other programs, WordPress, for example. I look at the first link and see, "Insalled PHP-XML... damn thing didn;t install in the first place... my bad." So it could be my own installation. I try to narrow the search by adding 'Drupal' as a parameter. Like this. Better. Four links. But the results are inconclusive. It could be my PHP installation (though the program should really deal with the problem a bit more elegantly). Or it could be the new Drupal.
I will be exploring my whole PHP situation in the future. So I'm going to set this aside for now. Lesson learned: actvate this sort of stuff way before you need it - you never know.
The Blog on a Drupal site is a place for each site member to create blog posts. On NewsTrolls, I allow any signed up member to have a blog. Here, I will be reserving the function to myself. Now normally I have just been using Blogger to create a blog. The reason for this was that Blogger is off the NRC's servers, which means I could do things - like express political opinions - that I couldn't do on the government machine. But now I'm off the government server. So, I'll activate the blog. But don't write off Blogger just yet.
This time, when I added the module, the following happened:
- I got a new content type (in addition to 'page' and 'story') under 'Create Content'
- I got a link to 'My Blog' in the left hand menu
- 'Blog entries' shows up as a block in the blocks menu
- In Administer Â» Content management Â» Content Types a listing for 'Blog Entry' showed up.
I went to the last item first, to check the administration options for 'Blog entry'. On this screen I am able to change the names of the fields ('title', 'body', 'description'), write blog post guidelines, and even change the name 'Blog entry' to something else. I change it to 'Blog Post' because I'm a purist.
Next I go to the Blocks menu. This is where I decided to put things in different columns. 'Blog Posts' now sits there, as a disabled block. Since I want blog posts to show up, I enable it and put it into the center column.
What I also notice is that my RSS feed sources and categories have shown up as block options. This means I don't want too many of either, because they would create a real problem in that menu. But it's kind of neat - were RSS working I could put my OLDaily feed right on my front page, simply by enabling this block.
So I now go to 'Create Â» Blog Post' and create a post. I submit it, and it shows up immediately on my front page. Perfect (though I would like to be able to rename my blog, something I don't seem to be able to do yet).
The Blog API is a way for applications to submit content to the Drupal website directly. This would allow, say, a desktop application to be used to write content offline, thn submit it to the website.
I will have may, many uses for the Blog API. So I enable it.
I notice, when I enable it, some messages on the page (were they there the previous two times? who knows?)
"It is important that update.php is run every time a module is updated to a newer version. You can find all administration tasks belonging to a particular module on the administration by module page."
The 'Administration by Module' page looks like a useful link, so I follow it. Very nice. Apparently it's an alternative Administration menu, where the administration is organized by module. This must have been created when I added the first module. Why knows?
Anyhow, I can see various options for each module, including links to the permissions menu (to make content or functionality available to different types of website users). I also see that there is a 'Get Help' option for each module.
I look at the Blog API settings and see that I can enable posting of each of my three major content types: Blog Post, page and story. Presumably, if I added more content types, they would also appear here.
I back out and look at the help menu. There are some links to background information about the Blogger API. Interestingly, I see my recent blog post at the bottom of my help page. Weird.
This option allows users to collaboratively author a book. This is not something we'll be doing on Newstrolls, but it is (sort of) something I'll be doing here, thouh (probably, maybe) without so much collaboration (I have to think about that - if I want just a few people to help, I would simply create a new role and give them access to this). So I activate this module.
Here's how it works: "The book module offers a means to organize content, authored by many users, in an online manual, outline or FAQ." In other words, "Pages in a book are like a tree." This accomplished (as you see on the 'Create Book Page' screen via a 'parent'. Whenever you create a new book page, you assign it to a parent.
I see the 'Book Page' content item has shown up under 'Content Types', which means I can edit this under the Content Types menu (which didn't show up under 'Administration by Module' - never trust handy things like this completely! Yes, there it is, right beside 'Blog Post'. I can change the names of the data fields, as before. What I wonder is, what if I want to create more than one book? The system doesn't seem to allow that. I guess what I would have to do is create a generic page, 'Books', and then create each new book as a new book page with 'Books' as it's parent. But that's cumbersome. Something to think about.
This allows to to put a contact form on your website, so people can send you messages. I'll try it and see whether I like like it.
I select it, then set the access permissions so people can see it. But it doesn't how up anywhere. So I navigate to the contact form administration screen. I click on the 'contact page' to see what's there by default, but I see nothing. I do notice that there's a box that says 'enable forms'. It is checked. There should be more happening than this.
So I decide to 'save settings' - to save what i see as the defaults - to see if that changes anything. Nope.
OK, so I go to the 'add category' screen. I decide to add a new category, 'Feedback', which will go to my own email address, which I type into the box. I provide some text for the auto-reply. Then I save the category. Now when I look at the contact page, I see a nice form people can fill out. Good.
But the link to the contact form still doesn't show up anywhere. The Administration page says, "The contact module also adds a menu item (disabled by default) to the navigation block." That seems like an odd way to do it - why would I select this module if I want it to be disabled?
I haven't really looked at menus yet (and I notice that it has now appeared as an option under 'Site Building'). Basically, you can create and manage any number of menus. The main menu - and the one you see at the top of the menu page - is the 'Navigation Menu' - this is what appears in the left-hand column. I see a bunch of things I've added that could be 'enabled' on this menu.
I click 'Enable' beside 'Contact'. This takes me to a screeen for the 'Contact' menu item. I accept all the defaults (I could change the name, or put it in as an item in a submenu, and more) and click Submit. 'Contact' appears on the ;eft-hand menu, where it should. Beauty.
According to the description, "Lets you register your site with a central server and improve ranking of Drupal projects by posting information on your installed modules and themes." Ok then....
What this is is rather more than that, though. It is basically a 'distributed authentication' system that lets one Drupal site call another and send it information. Drupal.og is using this to send site statistics (I think I'll leave that functionality off), but you can also use it to create a network of related sites.
I will have a lot to say about distributed authentication, but now is not the time. I'll leave this feature alone for now.
This is basically a bulletin board feature. It "enables threaded discussions about general topics." I don't need this.
Wirth noting, however, is that this module depends on two other modules, 'taxonomy' and 'comments'.
"Provides legacy handlers for upgrades from older Drupal installations."
Don't need this.
"Allows users to rename URLs." Nice - but will require the server redirect function mentioned in a previous installment. I will wait until I've resolved my server issues (and that will be a task, and a complete column in itself) before I think about this.
I might need it, though - because I am migrating from another server. I have a whole bunch of URLs I use now, which will all become errors if I simply swicth downes.ca from the old server to this one. I will need to hand all those requests, and I'd like to send people to what they're actually looking for, and not just an error message.
I hate Ping, but I might turn it on anyways. Not right away, though, because i on't want to be sending things that might change through Ping.
A lot of aggregators (not mine), in order to save themselves work, do not aggregate a site's RSS feed until the site sends it a message - a 'ping' - saying that there's new content. Then the aggregator will harvest the new RSS content.
'Ping' is useful because it says to these sites, first of all, 'I exist'. So people know the site has content.
The problem is, Ping only sends a 'ping' to sites it knows about. The biggest and most commercial. It gives those sites an advantage, and makes things harder for smaller sites.
As the name suggests, this allows me to put a poll on the website. I'll enable this, just for fun.
Poll shows up as a new content type. I first set the permissions, allowing people to vote in polls. Then I jump to 'Content Types' and click on 'Poll' (note that this link is not listed under 'Polls' in the 'Administer by Module' menu). Afain, I can change the names of the fields and the like. But I decide to leave the defaults.
So I click on 'Poll' under 'Create Content'. It's a pretty easy thing to create - type in a question (like, "Should I be using Drupal?") and then some possible answers. Then I click 'submit'. It shows me my poll - but can users see it? yes, it shows up as a content item in the center column, just like blog posts.
This allows people to edit their own user profiles. I'm not trying to build some sort of community here with profiles and all that, but it is nice to turn it on, as a courtesy to people who register as members.
When I enable profiles, nothing happens. I'm probably going to need to add it as a menu item. Hm - no, it's not listed there. Weird. OK, let's check access control. Nope. OK, let's look at the settings screen accessible from the Administration page.
It says, "Here you can define custom fields that users can fill in in their user profile (such as country, real name, age, ...)." There are "no fields defined" but a set of links offering to allow me to "add new field." I click on 'URL'.
This gets a bit complex. I am essentially defining a dtaa type - it asks me to submit a name for the field (the type is URL), a category (I type in 'Personal Information' and even the name of the database field! I type in 'profile_homepage'. I also choose to allow this to be visible, and to have it show up on the registration page.
I decide I want to ask people for their name as well. I select the 'single-line textfield' type, title it "Your Name" and, and set the other options as above. I also give it a 'weight' of 1. This means it will be placed higher that 'URL' - which makes sense, because I want people to enter their name first, their URL second (just like every other registration form in the world).
OK, that's enough. Has it shown up anywhere? No. Let's check Access Control first. Still not listed.
It takes a bit of searching, but find it. On the left hand menu, click 'My Account' - which has always been there. Under 'Edit' you can now edit 'account settings' - which has always been there - and 'Personal Information' - the category I just added. On that page you can see the fields 'Your Name' and 'Home Page'. Worth noting is that there is also a 'contact' form, under another tab. Who knew?
I want to think about how I manage this. It could be a way to set up newsletter subscriptions. But there may be some other, better, way of doing it.
Sure, I'll turn that on.
You wouldn't think there's much to do here, but there is. First of all, under Access Control, people need to be given access to it. Then, on the main settings page, Search needs to be configured.
The way search runs is it indexes the pages. Then when someone searches, they search the index, not the page itself. This is a lot faster. But it means the pages must be indexed from time to time. You can index pages manually, or (more normally) have the crontab take care of this behind the scene.
You can also weight the search results, either by keyword relevance, recency of posting, or number of comments. Very useful.
I give all users access to search using Access Controls. Then, using Blocks, I put the search box in the left hand column.
This module logs access statistics. I will be using the server, so I will leave this turned off (why make your computer do the same thing twice?).
This is something that handles site congestion. Shoudl one of my posts get Slashdotted, for example (and surprisingly, that has never happened), then I would be overwhelmed with visitors. This would handle the excess traffic.
So I enable it, because I'm sure to be Slashdotted eventually. ;)
Basically, the way Throttle works is that if a certain threshold is reached (250 per minute, for example) then a certain percentage of them (at random) are prevented from accessing the site.
I'll leave the numbers set at '0' (no throttling) for now. If I have a traffic problem, I'll use it on anonymous users first, allowing registered users full access.
"Enables tracking of recent posts for users." I won't be using this.
This lets people upload files. I won't be opening this up for general use, but I will certainly be uploading files, so I enable it.
Again, there is some configuration. I can set maximum resolutions for uploaded images, and maximum file sizes. I change the default (a paltry 1 megabyte) into something that can handle audio files (heh). I also add 'mp3' and 'doc' to the list of permitted file extensions.
When I submit this I get a warning: " Your PHP settings limit the maximum file size per upload to 2 MB." I will need to fix this. "Depending on your sever environment, these settings may be changed in the system-wide php.ini file, a php.ini file in your Drupal root directory, in your Drupal site's settings.php file, or in the .htaccess file in your Drupal root directory."
OK, it's another PHP issue. On to the todo list it goes.
Now, what happens here is that I don't see a menu item or black anywhere for this. Instead, what happens is that I am given the option to upload files along with any content.
If I take a look, for example, at the 'story' content item, underneath the input form I have a whole lot of new options. These appear for me because, as administrator, I have access to all these options. They show up for regular users only if I allow them in the Access Controls.
That's it for the built-in modules.
It should be apparent by now that it is possible to build a very flexible and functional site with Drupal out of the box. These commands are for the most part very simple, and assuming a more modern PHP installation than I have, work seamlessly (they have always worked for me in previous versions of Drupal and on other sites).
The proces so far may have seemed a bit dull - just running through feature after feature in Drupal. But if you have been following along, installing your own version of Drupal, this process is also really useful because it exposes to you, in a systematic way, to the full site capacities. This basic knowledge will be really useful when we do some fancy stuff, in the installments ahead.
That's it for now, though. Time for lunch.
SUBSCRIBE TO OLDAILY DONATE TO DOWNES.CA
Web - Today's OLDaily
Web - This Week's OLWeekly
Email - Subscribe
RSS - Individual Posts
RSS - Combined version
JSON - OLDaily
National Research Council Canada
All My Articles
About Stephen Downes
About Stephen's Web
Subscribe to Newsletters
Privacy and Security Policy
Stephen's Web and OLDaily
Half an Hour Blog
Google Plus Page
Huffington Post Blog