SPECIAL OFFER! Get 1 year of access to everything in OSTraining for only $59! You save $85!
Join today and get access to 1,000's of books and videos. Learn WordPress, Drupal, Magento, Joomla and more! Sign up today!

| Drupal

This tutorial will show you how to create a custom RSS feed in Drupal. To do this you'll need to have the Views module uploaded and installed.

Add a New View

tutuploadsmedia_1281956782171.png

Click Administer > Site building > Views > Add

tutuploadsmedia_1281957015067.png

Enter a name for your new RSS feed, choose "Node" and then click "Next"

Create an RSS Feed View

tutuploadsmedia_1281957075011.png

On the left-hand side, choose "Feed" from the dropdown and click "Add display".

Choose the Types of Node Shown in Your RSS Feed

tutuploadsmedia_1281957133613.png

On the right-hand side, click the + icon next to "Filters". Choose "Node" from the dropdown menu and then check the box called "Node: Type". Click "Add".

tutuploadsmedia_1281957160984.png

Choose the node types that you want to include in your RSS feed and then click "Update default display".

Choose the Parts of the Node Shown in Your RSS Feed

tutuploadsmedia_1281957263244.png

On the middle of the Views screen, click the + icon next to "Fields". Choose "Node" from the dropdown menu and then check the box called "Node: Title". Click "Add".

tutuploadsmedia_1281957285620.png

You can change some of the setting for the RSS feed display here, but the first time you do this its best to click "Update" and move on.

Set the Path of Your RSS Feed

tutuploadsmedia_1281957368581.png

At the bottom left of the Views screen, click the "None" text next to "Path". Enter a path (URL) for your RSS feed and click "Update".

Set the Style of Your RSS Feed

tutuploadsmedia_1281957410785.png

At the top left of the Views screen, click "Missing style plugins" next to "Row style". Click "Update".

View Your Completed RSS Feed

tutuploadsmedia_1281957527699.png

Click "View "Feed"" in the top-right corner of the Views screen.

tutuploadsmedia_1281957550013.png

Your RSS feed should be ready!

| Drupal

We're going to be adding a block position to a Drupal 6 theme called ShallowGrunge: http://drupal.org/project/shallowgrunge

The Goal

tutuploadsmedia_1273256567138.png

One of our students wanted to put a block position inside the red header bar. If you haven't done so already, download and install ShallowGrunge: http://drupal.org/project/shallowgrunge

The Current Blocks

tutuploadsmedia_1273256707673.png

Currently there is only a "content" and a "right sidebar" region.

Finding Where to Insert

tutuploadsmedia_1273257642831.png

I'm using the WebDeveloper toolbar for Firefox to help me identify the red header bar's area. I click on CSS >> View Style Information and then click on the area. The toolbar tells me that the area is called #menu

Opening the Files

tutuploadsmedia_1273256831165.png

In your site files, navigate to sites / all / themes / shallowgrunge / shallowgrunge.info and open that file

Add the Region Name

tutuploadsmedia_1273257117855.png

This file contains all the information Drupal needs to know about the theme. Now we're going to tell it about our new region. Currently only two regions are defined in this file. You'll need to add another using this line: regions[header] = Header

Open page.tpl.php

tutuploadsmedia_1273257231150.png

The file that controls the layout of our theme is page.tpl.php so let's open that up.

Add the Region Code

tutuploadsmedia_1273257391775.png

We scroll down in the file until we find the div called "menu" and we can insert our block code into there. The syntax is:

Check Your New Region

tutuploadsmedia_1273257562262.png

Check back in Administer >> Site building >> Blocks and your new "header" region should show.

| Drupal

This week's tutorial was requested by a student in our Drupal forum. They wanted to know how to add a slideshow to their Drupal site.

We recommend a module called Content Glider which allows you to show a slideshow in a block.

Installing Content Glider to Your Drupal Site

  • Step 1: Visit http://drupal.org/project/content_glider to download the latest version of "Content Glider".
  • Step 2: Extract the files into a folders on your desktop. The folder will be called "content_glider".
  • Step 3: Login to your site's files via FTP and navigate to /sites/all/. If there isn't a folder called /modules/ here, create one.
  • Step 4: Upload the "content_glider" folder to /sites/all/modules/
  • Step 5: Go to Administer >> Site building >> Modules and enable Content Glider.

Configuring Content Glider

Step 1: It's best to create a new content type for the slideshow, so we don't get mixed up with our other nodes.

  • Go to Administer >> Content Management >> Content Types
  • Click "Add Content Type" and create a type called "slideshow"

Step 2: Now we can go and configure Content Glider:

  • Go to Administer >> Site Configuration >> Content Glider
  • Put "slideshow" into the "Content type for Glider 1:" field.
  • Click "Save Configuration.

Step 3: Next, let's make Content Glider live on our site:

  • Go to Administer >> Site Building >> Blocks
  • Publish the "Content Slider 1" block onto your site.

Step 4: Finally we can create the content for the slideshow.

  • Go to Create Content >> Slideshow
  • Start adding the nodes that will appear in your slideshow ...

| Drupal

This week's tutorial is the second of a two-parter. We've had several students in our classes looking to build websites with multiple content authors ... blogs, newspapers, university sites and more. A common request is to improve Drupal's default handling of nodes.

In the first part we covered how to give people easy to a list of their own nodes, using a module called workspace.

In this second part we're going to create a workflow, allowing you to choose who has control over a node. A newspaper website is a great example - a writer may submit an article which is then passed to the copy-editor for checking and then to the editor for approval and publication.

In Part 1 we used the "Workspace" module. This time we're using the "Workflow" module.

Installing Workflow to Your Drupal Site

  • Step 1: Visit http://drupal.org/project/workflow to download the latest version of "Workflow".
  • Step 2: Extract the files into a folders on your desktop. The folder will be called "workflow".
  • Step 3: Login to your site's files via FTP and navigate to /sites/all/. If there isn't a folder called /modules/ here, create one.
  • Step 4: Upload the "workflow" folder to /sites/all/modules/
  • Step 5: Go to Administer >> Site building >> Modules and enable Workspace.

Configuring Workflow

Go to Administer >> Site building >> Workflow and click "Add workflow". You'll be at the start of the process:

  • Workflow name: Enter a name for your workflow.
  • Workflow states: You'll be asked for the different stages of the workflow. They example used by the module is "if you were doing a meal workflow it may include states like shop, prepare, eat, and clean up." Ideally you'll have several states. This is an example that a newspaper might use: Drupal Workflow
  • Nodes: You can then choose which nodes your workflow applies to:Drupal Workflow
  • Moving Through the Workflow: Click "Edit" next to your workflow and you'll be able to choose which user groups are in control at which stage. The workflow moves from left to right and you are choosing who can initiate the transition from one stage to the next.  Drupal Workflow
  • Managing Nodes in the Workflow: At the very bottom of this page you can decide what control people have over the articles in each state: Drupal Workflow
  • Tab: Mid-way on this screen you'll find "Workflow tab permissions" and you can control who sees the "Workflow" tab when they're looking at a node. This is how your users will move article through the workflow. At the top of the nodes they will see this added tab:
    Drupal Workflow
  • Using the Workflow: Once users click on the Workflow tab, they'll be able to change the state of the article and decide when:
    Drupal Workflow

| Drupal

This week's tutorial is the first of a two-parter. We've had several students in our classes looking to build websites with multiple content authors ... blogs, newspapers, university sites and more. A common request is to improve Drupal's default handling of nodes.

This week we'll show you how to give each person their own control panel for their nodes. This will allow them to much more easily see, understand and update the content they've submitted. Without it they'd be reduced to searching and guessing their way through the site to find their content.

Next week we'll focus on how to create a workflow and allow nodes to pass through several approval steps before publication.

In order to give each person their own control we're going to use a module called "Workspace":

Installing Workspace to Your Drupal Site

  • Step 1: Visit http://drupal.org/project/workspace to download the latest version of "Workspace".
  • Step 2: Extract the files into a folders on your desktop. The folder will be called "workspace".
  • Step 3: Login to your site's files via FTP and navigate to /sites/all/. If there isn't a folder called /modules/ here, create one.
  • Step 4: Upload the "workspace" folder to /sites/all/modules/
  • Step 5: Go to Administer >> Site building >> Modules and enable Workspace. You'll need to check only one box.
  • Step 6: When your users login they'll see a link in the admin menu called "My Workspace". When they click on it they'll see a screen like this:

Drupal Workspace Module

From this screen your users will be able to search for all their nodes, just as you search through them from Administer >> Content Management >> Content.

| Drupal

Would you like to be able to update your Drupal site and automatically send those updates to Twitter, Facebook, Linkedin, MySpace, Ning and dozens of other sites?

This tutorial will show you how.

Our first part will be to create an RSS feed to export new posts. From there we'll use Twitterfeed.com and Ping.fm to distribute the posts to all our social networks.

Creating an RSS Feed

There are at least three ways you export an RSS feed from your Drupal site. We'll break the options into easy, medium and hard:

Easy: You can just use Drupal's default feed. Simply add rss.xml to site's address. For example the main Drupal.org feed is at http://drupal.org/rss.xml. The downside is that you don't have much control of the feed's content. Whatever is on your site's frontpage will be included.

Medium: A module called "Syndication" will give you more control"

  • Drupal RSS FeedsStep 1: Visit http://drupal.org/project/syndication to download the latest version of "Syndication".
  • Step 3: Extract the files into a folders on your desktop. The folder will be called "syndication".
  • Step 4: Login to your site's files via FTP and navigate to /sites/all/. If there isn't a folder called /modules/ here, create one.
  • Step 5: Upload the "syndication" folder to /sites/all/modules/
  • Step 6: Go to Administer >> Site building >> Modules and enable "Syndication".
  • Step 7: In your admin menu you should now see an option called "RSS Feeds". Click on this menu link and you'll be able to create custom feeds based on either particular taxonomies or on particular blogs from the Blogs module.

Hard: You can use the "Views" module to completely customize your RSS feed. Full instructions are here.

Whichever route you use, the key is to end up with a URL for your feed at the end. Keep that safe and we'll use in a few minutes.

Sending your Feed to Twitter and Facebook

  • Step 8: We're going to use a service called Twitterfeed to send our news automatically to both Twitter and Facebook. The first step is to visit Twitterfeed.com and register.
  • Step 9: Login to Twitterfeed and click "Create New Feed".
  • Step 10: You'll see a box like the one below. Enter the title, and then paste the RSS feed from Step 6:
  • feed url

  • Step 11: Click "test rss feed" to make sure everything is OK. If it is, click "Continue to Step 2".
  • Step 12: This next part allows you to send your feed to Twitter and Facebook amongst other options:

    feed url

  • Step 13: Twitter and Facebook will allow you to authenticate your accounts and link them to Twitterfeed directly from this page. You can also add "UTM" tags which are designed for Google Analytics. They will show in your analytics results, so you can see how much traffic has been sent from Twitter or Facebook.

    feed url

  • Step 14: The final step is a really powerful feature here that many people overlook ... Ping.fm. If you create an account and authenticate it here with Twitterfeed, you can then pass on your updates to Linkedin.com, MySpace.com, Ning.com and dozens of others. There is a full list available here.

| Drupal

This week's tutorial explains how to add metadata to your Drupal site. By default, Drupal has no fields for metadata. Check the source code at http://drupal.org and you'll see what I mean. To fix that issue, we recommend a module called Nodewords.

Installing Nodewords to Your Drupal Site

  • Step 1: Visit http://drupal.org/project/nodewords to download the latest version of "Nodewords".
  • Step 3: Extract the files into a folders on your desktop. The folder will be called "nodewords".
  • Step 4: Login to your site's files via FTP and navigate to /sites/all/. If there isn't a folder called /modules/ here, create one.
  • Step 5: Upload the "nodewords" folder to /sites/all/modules/
  • Step 6: Go to Administer >> Site building >> Modules. You'll need to check only the first two of the four boxes if you'd like to add regular metadata:

    Enable Drupal Nodewords

  • Step 7: Go and create a new node. When you do, you should notice a new area labelled "Meta tags" and you'll be able to add metadata to all your nodes:

    metadata

  • Step 8: You can also give the search engines information about how this page should be crawled, by using the "Robots" checkboxes. These are the messages you can send to Google or Yahoo: robots
    • NOARCHIVE ... don't store a cache version of this page in your search results.
    • NOFOLLOW ... don't give any value to the outbound links on this page.
    • NOINDEX ... don't index this page in search results.
    • NOODP ... don't use any information from DMOZ.org to describe this site.
    • NOSNIPPET ... don't show any of this text on this page in your search results.
    • NOYDIR ... don't use any information from Yahoo Directory to describe this site.

Configuring Nodewords

The default Nodewords settings might not be to everyone's taste. There is no short cut to the Nodewords editing page, unless you to to Administer >> By Module >> Nodewords >> Meta tags. There you can choose global settings for your site's metatdata.

| Drupal

This tutorial was requested by a student who is learning the Drupal basics. They turned on "Clean URLs" in the Drupal admin area and were surprised to see that the URLs remained largely unchanged:

  • Old: /?q=node/3
  • New: /node/3

The student's comment was:

"that's still a silly address for my About Us page. I want the address to be /about-us/."

We also tried to help them by turning on the Path module in the Drupal core. That allowed them to create URLs like /about-us/ however they still needed to think about it and ask their users to create a path every time. They wanted something that would create great URLs automatically.

The solution is the "Pathauto" module and let's show you how to set it up:

Installing Pathauto to Your Drupal Site

In fact, we're going to install two modules because Pathauto also requires the "Token" module.

  • Step 1: Go to Administer >> Site configuration >> Clean URLs to check that they are enabled.
  • Step 2: Click here to download the latest version of "Pathauto" and click here for "Token".
  • Step 3: Extract the files into a two folders on your desktop. One  folder will be called "pathauto" and the other "token".
  • Step 4: Login to your site's files via FTP and navigate to /sites/all/. If there isn't a folder called /modules/ here, create one.
  • Step 5: Upload the "sections" folder to /sites/all/modules/
  • Step 6: Go to Administer >> Site building >> Modules. You'll need to check four boxes:

    Enable Drupal Pathauto

  • Step 7: Go and create a new node. When you do, you should notice a new area labelled "URL path settings". If you leave "Automatic alias" checked, the address of the page will likely be your Page title in this format:
    /content/your-page-title/

    Enable Drupal Pathauto

Configuring Pathauto

The default Pathauto setting might not be to everyone's taste:

  • You may want to use underscores _ instead of dashes as this student did.
  • You may want to remove /content/ so that you really can have pages with the address /about-us/ rather than /content/about-us/
To change the settings, go to Administer >> Site building >> URL aliases >> Automated Alias Settings:

Drupal Pathauto Settings

| Drupal

This tutorial was written after a request in one of this week's Drupal classes: "How do I show different Drupal themes on different pages?". The answer is a module called "Sections":

Installing Sections to Your Drupal Site

  • Step 1: Click here to download the latest version of "Sections".
  • Step 2: Extract the files into a folder on your desktop. The folder will be called "sections".
  • Step 3: Login to your site's files via FTP and navigate to /sites/all/. If there isn't a folder called /modules/ here, create one.
  • Step 4: Upload the "sections" folder to /sites/all/modules/
  • Step 5: Go to Administer >> Site building >> Modules. Check the box next to "Sections" and click Save Configuration.

Showing Different Drupal Themes on Different Pages

Now that Sections is set up, we'll be able to use it to place different themes on different pages:

  • Step 6: Go to Administer >> Site building >> Themes. Make sure that all the themes you want to use are enabled.
  • Step 7: Go to Administer >> Site building >> Sections and click "Add Sections".
  • Step 8: Give the section a name, click "enabled" and choose the theme you want to use.
  • Step 9: At the bottom of the page you'll see an area called "Page specific visibility settings". This is the same option you have with Blocks. Enter the pages you'd like this theme to appear on, click save and you're done!

| Drupal
One of things we often do for our training clients is simplify the admin area for them. There is a module that allows users to manage their site via a clean, dropdown menu. It has proven so popular that companies such as Acquia provide it by default to all their customers:
Here's how to install it:
  • Step 1: Click here to download the latest version of "Admin Menu". Choose the top link under "Recommended releases".
  • Step 2: Extract the files into a folder on your desktop. The folder will be called "admin_menu"
  • Step 3: Login to your site's files via FTP and navigate to /sites/default/. If there isn't a folder called /modules/ here, create one.
  • Step 4: Upload the "admin_menu" folder to /sites/default/modules/
  • Step 5: Go to Administer >> Modules >> Administration menu and check the box.  
  • Step 6: Click 'Save Configuration" at the very bottom of the screen.
  • Step 7: Go to Administer >> Site configuration >> Administration menu and there are some settings you can edit.

Once you've followed those seven steps, your dropdown menu should appear at the top of the page.

Drupal Admin Menu

| Drupal

What is a WYSIWYG Editor and Why Do You Need It?

So your site users don't have to use code. Its as simple as that.

WYSIWYG stands for "What You See Is What You Get" ... if you select some text and click the "bold" button, that text will be bold. If you select some text and click the "italic" button, that text will be in italics. There's no messing around with HTML. That will be a relief to some of you and more particularly ... your clients and site visitors.

Installing the WYSIWYG Module

First of all, we're going to install a WYSIWYG module that will allow Drupal to install a range of different editors.

  • Step 1: Click here to download the latest version of "WYSIWYG". Choose the top link under "Recommended releases".
  • Step 2: Extract the files into a folder on your desktop. The folder will be called "wysiwyg"
  • Step 3: Login to your site's files via FTP and navigate to /sites/all/. If there isn't a folder called /modules/ here, create one.
  • Step 4: Upload the "wysiwyg" folder to /sites/all/modules/
  • Step 5: Go to Administer >> Site building >> Modules. Check the box next to "Wysiwyg" and click Save Configuration.
  • Step 6: Go to Administer >> Site configuration >> Wysiwyg and you should see a screen with several suggested editors. One option is TinyMCE and that is the example we will use:
Adding a WYSIWYG Editor to Your Drupal Site

Installing TinyMCE

Now we're going to install the TinyMCE editor itself:

  • Step 7: Click on the "Download" link or go directly to http://tinymce.moxiecode.com/download.php
  • Step 8: Download the latest TinyMCE to your desktop and extract the files. The folder will be called "tinymce 2". Rename this to simply "tinymce"
  • Step 9: Login to your site's files via FTP and navigate to /sites/all/. If there isn't a folder called /libraries/ here, create one.
  • Step 10: Upload the "wysiwyg" folder to /sites/all/libraries/
  • Step 11: Go back to Go to Administer >> Site configuration >> Wysiwyg and screen we saw before should now look like this:
Adding a WYSIWYG Editor to Your Drupal Site
  • Step 12: Save these settings and now when you go to edit an article, you should see a fully-fledged editor:
Adding a WYSIWYG Editor to Your Drupal Site

| Drupal

Why Block Spam Comments?

MollomIf you site is new, this might not be too much of a problem. However, as your site grows, it will increasingly be seen as a valuable target for spammers. If they succeed in placing links on your site, they may get a couple of benefits:

  • Search engines may rank the spammer's site more highly
  • Unsuspecting users may click on the link and visit the spammer's site.
Perhaps the best solution available for Drupal sites is Mollom - a module created by Drupal's founder. It automatically filters out spammers who try to register, comment or contact you.

Install Mollom to Your Drupal Site

  • Step 1: Click here to download the latest version of "Mollom". Choose the top link under "Recommended releases".
  • Step 2: Extract the files into a folder on your desktop. The folder will be called "mollom"
  • Step 3: Login to your site's files via FTP and navigate to /sites/default/. If there isn't a folder called /modules/ here, create one.
  • Step 4: Upload the "mollom" folder to /sites/default/modules/
  • Step 5: Go to Administer >> Site building >> Modules. Check the box next to "Mollom" and click Save Configuration.

Setting Up and Enabling Mollom

  • Step 6: Go to Mollom.com and create an account.
  • Step 7: Once you have logged in to Mollom.com, click "Manage sites" in the upper right menu.
  • Step 8: Select "Add subscription" to create a new key pair for your website (or "edit subscription" to access a subscription for an existing site tied to your account).
  • Step 9: Go back to your Drupal site and visit Administer >> Site configuration >> Mollom.
  • Step 10: Enter the key pair that you created in Step 8.

Once the module is active you can log back in to Mollom.com in future weeks to track how much spam has been prevented on your site.

| Drupal

Why Add a Sitemap?

I'll be honest and say that I don't believe sitemaps improve your ranking in search engines. However, they do make sure more pages get indexed and that they get indexed more quickly. This article presents evidence that the difference is astounding:

  • Google with a sitemap: 14 minutes
  • Google without a sitemap: 1375 minutes
  • Yahoo with a sitemap: 245 minutes
  • Yahoo without a sitemap: 1773 minutes

How to Add a Sitemap to Your Drupal Site

  • Step 1: Click here to download the latest version of "XML Sitemap". Choose the top link under "Recommended releases".
  • Step 2: Extract the files into a folder on your desktop. The folder will be called "xmlsitemap"
  • Step 3: Login to your site's files via FTP and navigate to /sites/default/. If there isn't a folder called /modules/ here, create one.
  • Step 4: Upload the "xmlsitemap" folder to /sites/default/modules/
  • Step 5: Go to Administer >> Modules >> Administration menu and check the box next to "XML sitemap" and click "Save Configuration".
  • Step 6: After saving you'll presented with more options. Checking all the boxes would be a good choice.
Drupal Sitemap

Submitting the Sitemap to Search Engines

Drupal Sitemap

| Drupal

In this tutorial we'll show you how to place a Twitter feed inside a block. You can then display that Twitter feed anywhere around your theme. There are many different Twitter options out there but most have a couple of limitations:

  • They post tweets as nodes rather than in a block.
  • If they post to a block, they require very complex setups normally involving creating Views.

Thanks to Expedition Post, we're going to suggest a much simpler way to show tweets in a block on your site. They've created a script that is very cleverly called "Twitter Block".

Installing Twitterblock to Your Drupal Site

  • Step 1: Click here to download the latest version of "Twitter Block".
  • Step 2: Extract the files into a folder on your desktop. The folder will be called "twitterblock".
  • Step 3: Login to your site's files via FTP and navigate to /sites/default/. If there isn't a folder called /modules/ here, create one.
  • Step 4: Upload the "twitterblock" folder to /sites/default/modules/
  • Step 5: Go to Administer >> Site building >> Modules. Check the box next to "Twitter Block" and click Save Configuration.

Placing Your Twitter Feed in a Block

Now that Twitter Block is set up, we'll go and place it on our site:

  • Step 6: Go to Administer >> Site building >> Blocks. Scroll down to find Twitter Block.
  • Step 7: Click "Configure" next to the block and enter your Twitter username and password:
  • Drupal twitterblock Module
  • Step 8: Click "Save Block", publish the block and check to see how it looks on your site:

  • Drupal twitterblock Module

| Drupal

In this tutorial we'll show you how to place an RSS feed inside a block. You can then display that RSS feed anywhere around your theme. We don't need any extra modules this week as we'll be using the core Aggregator Module:

Setting up the Aggregator Module

First of all, we're going to set up the Aggregator module so that it can handle the RSS feeds for us.

  • Step 1: Go to Administer >> Site building >> Modules. Check the box next to "Aggregator" and click Save Configuration.
  • Step 2: Go to Administer >> click "By module" at the top.
  • Step 3: Find the "Aggregator" area right at the top and then click on "Feed aggregator":

  • Drupal Aggregator Module

  • Step 4: Click "Add Feed" along the top and enter the address of your RSS feed:

  • Drupal Aggregator Module

  • Step 5: Click "Save" and then "update items". That will load the latest articles from your RSS feed.

Placing the RSS Feed in a Block

Now that Aggregator is handling the RSS feeds for us, we'll go and place it into a block on our site:

  • Step 6: Go to Administer >> Site building >> Blocks. Scroll down to find the block with the same name as the feed your created in Step 4. Aggregator has automatically created this for you.
  • Step 7: More than likely, you will need to click "Configure" next to the block and choose a new title. Aggregator creates a default title of "[feed name] feed latest items".
  • Step 8: Publish the block and check to see how it looks on your site:

  • Drupal Aggregator Module
Page 16 of 16
Join today and get access to 1,000's of books and videos. Learn WordPress, Drupal, Magento, Joomla and more! Sign up today!