Monday, July 16, 2012

Installing Drupal on Windows with PostGRESQL DB

The Downloads:

The system requirements for Drupal are given here. In short, download Apache, PHP (download BOTH the installer and the zip version), Post GRE SQL.

The Configuration:

The step-by-step instruction to install Drupal is given here and it's fairly intuitive.

The Gotchas:

There were a couple of things to watch out for:

1. PHP looks for the config file (php.ini) in C:\Windows (or the equivalent windows folder) by default and that file isn't automagically created. So we need to add the PHP installation folder path to the PATH variable. In my case, I added C:\Program Files (x86)\PHP to the PATH variable.

2. Drupal uses PDO (PHP Data Objects) to connect to a database and you should be having a PDO (which is usually a DLL) for each DB you intend to support. However, this DLL is not provided in the PHP installer; and even if you go around hunting for that DLL file in Google, you will hit nothing but road blocks. So after you install PHP using the installer, unzip the contents of the PHP zip version that you downloaded (to a different folder of course) and copy the php_pdo_pgsql.dll file from the ext folder (under the extracted PHP folder) to the actual ext folder (created by the windows installer). Then, the php.ini file needs to be updated to include the following lines:
[PHP_PDO_PGSQL]
extension=php_pdo_pgsql.dll

Once this is done and the apache server is (re)started, following the step-by-step Drupal installation instructions should do the magic.

Thursday, July 12, 2012

Drupal feature Module example

In this example we create an Online Videos feature. The site builder configured a lot in preparation of this feature we are currently not interested in.

Step 1. admin/build/features/export



As you can see we added a name, description and a version. Next step will be defining what this feature provides.

Step 2. Select features components.

From the "Add Components" dropdown we have to select the components the feature consists off. This is about a video node so we select "Node". From the checklist we only need the video node type.



The auto-detect functionality grabs the required building blocks node (video), content (video-field_video), modules (emvideo, features). Therefore, when we want to install the feature, we need to make sure we have installed the required modules.

Step 3. Download the feature.

When satisfied with all components, click the download button and save the tarball (in this case, online_videos-6.x-1.0-alpha1.tar.gz).

Step 4. Install and enable the feature.

Best thing to do is untar the file in your current project. As described above, features are not listed on the site/build/modules page even though they are technically modules. To keep them separate, you should consider putting all of your features in a separate directory — e.g., site/all/modules/custom/your-feature.



The feature now appears at admin/build/features. Checking the box next to the feature's name and saving page causes the features module to check for the current state all features.

Step 5. Visit admin/build/modules

When checking for the module online video module it's not there. Searching for the name would show you a dependency on online_video module. To disable such a module you have to disable the feature first.

Notes

  • We have said nothing about what drupal projects you need to install to be able to install our example feature.
  • If we had created a view this would be exported too. test it yourself.

Tuesday, June 19, 2012

Deploying local to remote sites drush site aliases


Deploying local to remote sites drush site aliases by kiwipion

Introduction

In this tutorial we are going to deploy a copy of our current local site across to what we will term our staging server using the Drush function site aliases. For ease of use the staging server will be on the local machine as well, but you can use the same principal for propagating across to a remote server such as a shared host.

Prerequisites

For you to follow these instructions you will need the followng setup on your machine

  • Local environment set up ie MAMP for mac
  • Drush installed.

Preparation

Implement your own aliases.drushrc.php file. You can copy the example.aliases.drushrc.php from the examples directory to either your local drush root directory or into your drupal installation make sure you read the instructions at the top of this file to ensure that it gets picked up buy drush.

There are two very good articles that can be used as reference here http://emspace.com.au/article/drush-aliases-primer-live-dev-syncing & here http://drupal.org/node/670460

Go into your drush/examples folder and copy the examples.aliases.drushrc.php to a location of your preference, I'll be putting mine in the drupal installation directory and renaming it to mysite.aliases.drushrc.php.

For reference here are my aliases for @mysite.dev & @mysite.stage

$aliases['dev'] = array(     'uri' => 'myserver.myserver',     'root' => '/sites/mysite',     'path-aliases' => array(       '%drush' => '/Users/nigelhenshaw/dev/drush',       '%drush-script' => '/Users/nigelhenshaw/dev/drush/drush',       '%dump-dir' => '/sites/SQL/dumps/',       '%dump' => '/sites/SQL/sql-dev.sql',       '%files' => 'sites/drupalovereasy.com/files',      ),   );   $aliases['stage'] = array(     'uri' => 'myserver.stage',     'root' => '/sites/mysite.stage',     'path-aliases' => array(       '%drush' => '/Users/nigelhenshaw/dev/drush',       '%drush-script' => '/Users/nigelhenshaw/dev/drush/drush',       '%dump-dir' => '/sites/SQL/dumps/',       '%dump' => '/sites/SQL/sql-stage.sql',       '%files' => 'sites/drupalovereasy.com/files',      ),   );

Inform the drushrc.php file of the location of the aliases file in ['alias-path'] section.

Now check that drupal is scanning your alias file correctly and your configuration is correct by running

drush sa

You should be something like this, which will confirm that drush is scanning your alias file and the context of your alias is correct.

@self @mysite.dev @mysite default

The alias I definned is @mysite.dev

Let's see if we can backup the contents of the database by doing a drush dump, this will be the command that I will be running

drush @mysite.dev sql-dump > `drush dd @mysite.dev:%dump`

A copy of my database should now be downloaded at /sites/SQL/dumps/, which was specified in the the mysite.aliases.drushrc.php

Now I'm going to repeat the process and create alias settings for my staging server which I will call mysite.stage

Deploy

There are two steps required for migrating across to a new site location that has not yet been populated

1/ Rsync the code across

% drush rsync @mysite.dev @mysite.stage

2 / Configure the database and ensure that settings.php is aligned with it.

3/ Sql-sync the database across

% drush sql-sync @mysite.dev @mysite.stage 

Your staging site should now be up and running.

Synchronization

Once a remote site has been installed you will have to consider how you will maintain the site after ie how do you manage source code and database content. Normally source is pushed up to the remote server and database content is pulled down. An example demonstrating this would be upgrading a site where that database content has been pulled down to the staging server using drush sql-sync. The source code is then pushed up to the staging server from the local dev server using drush rsync, then staging server is tested and verified. Once passed the validation criterea the remote live site will then be put into maintenance mode with the latest copy of the database sync'd back down to the staging server. The validation testing would normally be re-run and then the source code would be merged up to the live server.

This is a very light-weight example which I'm using the demonstrate the direction of source code versus database data in relation to each other, which is different from what we did with the brand new setup of the staging server that had both the source code and database content pushed to the staging server.

Final Thoughts

In closing it will be interesting to see how drush rsync and sql-sync will develop in regards with the work happening in git and dog, I have seen discussions of installing git on the live server and merging the code up but I don't yet know if it is possible to install git on a shared host without the root access. And I do find the drush rsync & sql-sync fast and simple to use.

And my final word for the day "always make sure you backup the database before running the sql-sync command".

Sunday, June 10, 2012

MySql replication on same Windows machine

1. First install mysql-5.5.11-win32.msi on windows machine. While installing choose custom installation and change
installation path to D:\MySQL\MySQL Server 5.5
2. Use all the default parameter like Service name is MYSQL and port number is 3306 and setup bin path.
3. And also modify root password to mysql.
3. Now check whether your installation is correct or not.
4.Open dos prompt and type below command.
c:\> mysql -uroot -pmysql -hlocalhost -P3306;

If you get mysql command then everything is ok.
We will treat mysql 5.5 is MASTER.
Now create one database:

mysql> create database santosh;

5. Now install another version of mysql (mysql-5.1.56-win32.msi) for SLAVE. Again while installing choose custome
installation and change installation path to D:\MySQL\MySQL Server 5.1
6. Change service name to MYSQL2 and port number to 3307
7. Modify root password to root.
8.Now check whether your installation is correct or not.
9.Open new dos prompot and type below command.

c:\> mysql -uroot -proot -hlocalhost -P3307;

If you get mysql command then everything is ok.
We will treat mysql 5.1 is SLAVE.
Now create one database:
mysql> create database santosh;

Up to here two mysql instance are running in your windows machine.

Now start the replication implementation.

1. Open D:\MySQL\MySQL Server 5.5\my.ini then add four options to the [mysqld] section of the my.ini file

[mysqld]
log-bin=dellxp1-bin.log
server-id=1
innodb_flush_log_at_trx_commit=1
sync_binlog=1

save it.
Restart the MYSQL service from your pc. MyComputer -> Right click -> click on Manage -> Services and Application -> Services ->
search MYSQL on right side, right click on that MYSQL and click on restart.

The next step in setting up replication is creating an account that will be used exclusively for replication. We strongly advise creating a dedicated replication user be created for better security so you won’t need to grant any additional privileges besides replication permissions. Create an account on the master server that the slave server can use to connect. As mentioned, this account must be given the REPLICATION SLAVE privilege.

Open one dos windows for all MASTER operation.
c:\>mysql -uroot -pmysql -hlocalhost -P3306;
mysql> create user ‘replication_user’ identified by ‘password’;
mysql> grant replication slave on *.* to ‘replication_user’@'%’ identified by ‘password’;
mysql> flush privileges;
mysql> FLUSH TABLES WITH READ LOCK;
mysql> SHOW MASTER STATUS;

+——————–+———-+————–+——————+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+——————–+———-+————–+——————+
| dellxp1-bin.000001 | 338 | | |
+——————–+———-+————–+——————+
1 row in set (0.00 sec)

Please note down this file name and position, it will use to later.

Now take your backup of your MASTER database as we have new database so this below step are not required. But when you have to create SLAVE of running database then it step must be required, so lets go these below step too.

Open new dos prompt.

Taking backup from MASTER:
C:\>mysqldump -uroot -pmysql -hlocalhost -P3306 santosh> d:\test2.sql

Now export this back to SLAVE, run below command on same dos windows.
C:\Users\sumankbi>mysql -uroot -proot -hlocalhost -P3307 santosh< d:\test2.sql

Now some change on SLAVE side:
1. Open D:\MySQL\MySQL Server 5.1\my.ini then add four options to the [mysqld] section of the my.ini file

[mysqld]
server-id=2

save it.
Restart the MYSQL2 service from your pc. MyComputer -> Right click -> click on Manage -> Services and Application -> Services ->
search MYSQL on right side, right click on that MYSQL2 and click on restart.

Open one dos windows for all SLAVE operation.
c:\>mysql -uroot -proot -hlocalhost -P3307;

mysql> stop slave;
mysql> CHANGE MASTER TO
MASTER_HOST=’localhost’,
MASTER_USER=’replication_user’,
MASTER_PASSWORD=’password’,
MASTER_PORT=3306,
MASTER_LOG_FILE=’dellxp1-bin.000001′,
MASTER_LOG_POS=338;

mysql> show slave status\G;
Output will come huge, among two line should be like:
Slave_IO_Running: No
Slave_SQL_Running: No

Because slave is stopped now.
Now time came to start slave.
on slave side:

mysql> start slave;
Now check slave status:
mysql> show slave status\G;
Output will come huge, among two line should be like:
Slave_IO_Running: Yes
Slave_SQL_Running: Yes

If both values are Yes, then everything are ok.

Now you can check your replication work.

Create some table in MASTER santosh database or any database (those should be there at SLAVE side) then check at slave side.

Now you stop slave again then you change of MASTER will not come but once again you will start slave then slave will get automatically updated from last time stopped pointer.

More details on http://dev.mysql.com/doc/refman/5.0/en/replication.html

Thanks:

Santosh

Monday, May 14, 2012

Drupal Site Configuration: Site Information, Triggers and File

People often assume that the basics are easy to master and therefore, don't require much thought. Things are not quite so simple in reality because while a site's basic setup is, more often than not, easy to implement, the more subtle problem is in knowing what to implement, and how to implement it in the first place. Precisely understanding what you need from a site is particularly important for this reason.

Does this mean that you should not start working directly on the site unless you know exactly what is required? Not really; like most things, it's a bit of a trade-off when it comes to starting out with the development of a Drupal website. This is because it is almost impossible to determine exactly what the site will need and how its functionality should be provided until you have been working with it for some time. Often, you will find yourself modifying the behavior of a site based on feedback from the users.

In this article by David Mercer, author of the book Drupal 7, we are going to talk about the following Drupal site configuration topics:

  • Site information
  • Actions and Triggers
  • Shortcuts
  • File system

(For more resources on Drupal, see here.)

Not everything that is available in Drupal's Configuration section is discussed in this article. Some settings are very straightforward and really don't warrant more than perhaps a brief mention.

Before we start

It is sensible to make note of a few important things before getting our hands dirty. Make it second nature to check how the changes made to the settings affect the site. Quite often settings you modify, or features you add, will not behave precisely as expected and without ensuring that you use a prudent approach to making changes, you can sometimes end up with a bit of a mess.

Changes to the site's structure (for example, adding new modules) can affect what is and isn't available for configuration so be aware that it may be necessary to revisit this section.

Click on Configuration in the toolbar menu. You should see something like the following screenshot:

A quick point to mention is that we aren't giving over much space to the final option—Regional and Language. This is because the settings here are very basic and should give you no trouble at all. There is also an online exercise available to help you with date types and formats if you are interested in customizing these.

Let's begin!

Site information

This page contains a mixed bag of settings, some of which are pretty self-explanatory, while others will require us to think quite carefully about what we need to do. To start with, we are presented with a few text boxes that control things like the name of the site and the site slogan.

Nothing too earth shattering, although I should point out that different themes implement these settings differently, while some don't implement them at all.

For example, adding a slogan in the default Garland theme prints it after the site name as shown in the following screenshot:

Whereas, the Stark theme places the slogan beneath the site name:

Let's assume that there is a page of content that should be displayed by default—before anyone views any of the other content. For example, if you wanted to display some sort of promotional information or an introduction page, you could tell Drupal to display that using this setting. Remember that you have to create the content for this post first, and then determine its path before you tell Drupal to use it. For example, we could reference a specific node with its node ID, but equally, a site's blogs could be displayed if you substitute node/x (in node/ID format) for the blog.

Once you are looking at the content intended for the front page, take note of the relative URL path and simply enter that into the text box provided.

Recall that the relative URL path is that part of the page's address that comes after the standard domain, which is shared by the whole site. For example, setting node/2 works because Drupal maps this relative path to http://localhost/drupal/node/2

The first part of this address, http://localhost/drupal/ is the base URL, and everything after that is the relative URL path.

Sometimes, the front page is a slightly more complex beast and it is likely that you will want to consider Panels to create a unique front page. In this case, Panels settings can override this setting to make a specific panel page as the front page.

The following settings allow you to broadly deal with the problem of two common site errors that may crop up during a site's normal course of operation—from the perspective of a site visitor. In particular, you may wish to create a couple of customized error pages that will be displayed to the users in the event of a "page not found" or "access denied" problem.

Remember that there are already pretty concise pages, which are supplied by default. However, if you wish to make any changes, then the process for creating an error page is exactly the same as creating any other normal page.

Let's make a change very quickly. Click on Add new content in the Shortcuts menu and select Basic page. Add whatever content you want for, say the Page not found! error:

Don't worry about the host of options available on this page—we will talk about all of this later on. For now, simply click on the Save button and make note of the URL of the page when it is displayed. Then head back to the Site information page, add this URL to the Default 404 (not found) page dialog, and then click on the Save configuration button:

If you navigate to a page that doesn't exist, for example, node/3333, you should receive the new error message as follows:

In this example, we asked Drupal to find a node that does not exist yet and so it displayed the Page not found! error message. Since Drupal can also provide content that is private or available to only certain users, it also needs the access denied error to explain to the would-be users that they do not have sufficient permissions to view the requested page. This is not the same as not finding a page, of course, but you can create your own access denied page in exactly the same way.

Finally, you will need to specify how often cron should run in the Automatically run cron drop-down at the bottom of the Site information page. Cronjobs are automated tasks (of any type—they could be search indexing, feed aggregation, and so on) that should run at specified intervals. Drupal uses them to keep itself up-to-date and ensure optimal operation.

Drupal uses web page requests to initiate new cron runs once the specified interval has elapsed. If your website does not get visited regularly, cron itself cannot run regularly.

Running cron every few hours is reasonable for the vast majority of sites. Setting it to run too quickly can create a huge load on the server because each time the cron is run, all sorts of scripts are updating data, performing tasks, and consuming server resources. By the same token, run cron too infrequently and your site's content can become outdated, or worse, important module, theme, and core updates can go unnoticed, among other things.

Actions and triggers

Quite often, it happens that for specific events, it is useful to have Drupal automatically perform a specified task or action. An action, in the Drupal sense, is one of a number of tasks that the system can perform, and these usually relate to e-mailing people or acting upon user accounts or content. There are a number of simple actions that are available as well as a few more advanced ones that can be set up by anyone with sufficient permissions.

To configure actions, navigate to Actions in SYSTEM under the Configuration menu in the toolbar:

Default simple actions cannot be modified, so we will ignore these for the moment and focus on creating a new, advanced action. Set up a new Send e-mail action by selecting it from the drop-down list and click on the Create button, as shown in the preceding screenshot. This brings up the following page that can be set according to how this specific action will be used:

It should be clear that the intention of this e-mail is to notify the staff/administration of any new site members. The Label field is important in this respect because this is how you will distinguish this action from the other ones that you may create in the future. Make the description as accurate, meaningful, and concise as possible to avoid any potential confusion.

Also notice that there are several placeholder variables that can be inserted into the Recipient, Subject, and Message fields. In this instance, one has been used to inform the e-mail recipient of the new user name, as part of the message.

A click on the Save button adds this new action to the list where it can be modified or deleted, accordingly:

So far so good—we have set the action, but this in itself does absolutely nothing. An action cannot do anything unless there is a specific system event that can be triggered to set it off. These system events are, perspicaciously enough, called triggers and Drupal can look for any number of triggers, and perform the actions that are associated with it—this is how actions and triggers work together.

Triggers are not part of the topic of Drupal configuration. However, we will discuss them here for completeness, since actions and triggers are integrally linked.

Triggers are not enabled by default, so head on over to the Modules section and enable the Triggers module. With the module enabled, there will now be a new Triggers link from the Actions page. Clicking on this brings up the following page:

Triggers are divided into five different categories, each providing a range of triggers to which actions can be attached. Assigning a trigger is basically selecting an action to apply from the drop-down list of the relevant trigger and clicking on the Assign button.

To continue with our example, select the USER tab from the top of the Triggers overlay and, in the TRIGGER: AFTER CREATING A NEW USER ACCOUNT box, select the newly defined action, as shown in the following screenshot:

Click on the Assign button, and the newly assigned action will show up in the relevant trigger box:

In the same way, a large number of actions can be automated depending on the system event (or trigger) that fires. To test this out, log off and register a new account—you will find that the New User Alert e-mail is dutifully sent out once the account has been registered (assuming your web server is able to send e-mail).

Drupal 7

Drupal 7

Create and operate any type of Drupal 7 website quickly and efficiently

Read more about this book

(For more resources on Drupal, see here.)

Shortcuts

Shortcuts are a new feature of Drupal 7 and allow administrators (or anyone with sufficient permissions) to create sets of links that can be accessed by others using the shortcuts bar—directly below the toolbar menu. By default, Add content and Find content are the only two links that are provided, but you may change these regularly depending on what you are working on at any given time.

For example, it may be useful to create a set of shortcuts that involve theme-related links for quick access when it's time to theme the site. By the same token, adding links to views and displays might be more useful when working on content.

The overlay system is integrated with shortcuts, making it easy for the administrators to add links to their shortcuts. For example, let's say we wanted a set of configuration shortcuts so that all the main configuration tasks are readily accessible at a moment's notice.

To do this, we need to first add a new shortcut set. Go to Shortcuts in USER INTERFACE under Configuration, and click on the Add shortcut set link, to bring up the following page:

Now go to your account, and select the Shortcut tab. Select the new Configuration option and save the changes by clicking Change set to ensure that you are viewing the correct shortcut set. Now click on Edit shortcuts in the shortcuts bar to bring up the list of links contained in this set:

Nothing too exciting yet. In fact, this is exactly the same as the default shortcut set. We can add new shortcuts to this list manually by clicking on the Add shortcut link and providing a name and path manually:

Clicking on the Save button shows the new link added to the list and it is also now available in the shortcuts bar on the top of the page.

The other, easier way to add links is simple; click on the plus icon next to the overlay name. A small popup appears to the right of the icon while hovering over it. Take note of this because it indicates which shortcut set the link will be added to.

The new shortcut will appear along the top of the page with the rest of the links.

Anyone with sufficient permissions can create their own set of shortcuts and use them as they choose. The shortcuts system also provides a block that can be added to the site like any other block. Making effective use of shortcuts can help you cut down the wasted navigation time—just remember to select the most relevant set from your account because it is only possible to view one at a time.

File system

How you deal with the file system settings really depends on what type of content you visualize your site using. If you know that most files should be available for anyone to download, then leave the Default download method as Public. By the same token, if you want some control over who can access the files then use the Private method.

Public files can be accessed directly through a browser without having to go through your Drupal website. So, if someone liked a video you posted, they could reference it from their own website, allowing their visitors to see the video using your bandwidth to serve it—obviously not ideal.

You need to keep an eye on this and find out if your host service provides some sort of hotlinking protection to combat this.

Assuming you want to make your download method private, you will need to specify a directory that is not directly available over the web—in other words, it is outside the document root folder.

The same technique is used for the temporary files folder that Drupal requires in order to properly handle any files you or the site users might deal with.

On your development machine, you might end up with something like the following screenshot (Public file downloads):

To make this private, create a folder outside of the web root (but still within the web server folder), add it to the Private file system path option, and click on the Save configuration button, as shown in the following screenshot:

With the new absolute path to the private folder specified (in this case, privatedrupalfiles) there will now be an additional Default download method available for selection, entitled Private local files served by Drupal.

The Default download method is the default behavior. Individual download methods can be set on each file type field added to any content type.

Before continuing, let's confirm that we can specify a download method for any file without problems. Go to Content types under Structure, and click on the manage fields link next to one of the content types, say blog entry. Add a new field of the File type and save the changes. You will then be able to select Public files or Private files in the Upload destination section on the following configuration page, as shown in the next screenshot:

The important point here is that each file uploaded to the site can be controlled on a field level basis, and more importantly on a field level per content type basis. This is a vast improvement over Drupal 6 which forced either all files to be public or all to be private.

How Drupal controls what type and the size of the files that can be uploaded is a matter for the content type specific configuration page shown in the preceding screenshot. It is not really sensible to allow any type of file to be uploaded to the site. The first thing that will happen if you do this, is that someone will upload a malicious executable file that does something nasty when it runs on the users' machines, in turn, causing them to say or do something nasty to you.

For example, you might know that for a particular content type, the only type of file that should be uploaded is a small text or .txt file. In this case, you would have something like the following settings:

In this case, we have specified that only 'txt files' of less than 50 KB can be uploaded to the blogtext sub-directory. The decisions you ultimately make should be dictated by the needs of the individual site. When in doubt, follow the tenet:

Provide only what is absolutely necessary, and no more!

The actual settings themselves are easy enough to implement, but I suggest you do not add any file extensions that you know the site will not need. Remember that it is possible to cloak nasty software within other file types, so the more variety you allow, the less secure things become.

We can test all of this out by posting a new blog and trying to upload files. Try a range of files, not just 'txt' files to see the results. For example, attempting to upload an image file gives the following result:

However, uploading a new file that does meet the criteria set, meets with success and we can check to ensure that the file is present in the proper sub-directory of the file system, as shown next:

As you can see, the site has correctly uploaded the blogtextfile.txt file in the blogtext subdirectory, as specified earlier. The field-based system for file handling in Drupal 7 represents a huge improvement over previous Drupal milestones.

Summary

This article has covered a fair amount of ground in terms of setting up the site. We began by looking at some general configuration settings, like Site information, that are important in terms of getting the nuts and bolts in working order. Many of these settings will need to be revisited as the site develops.

While triggers aren't necessarily part of a discussion on configuration, we learned that they are inextricably linked to actions that can be configured to automate many common site tasks or chores. Again, coming back to actions and triggers every once and a while can help reduce the number of repetitive tasks that have to be completed manually.

Next, we gained the ability to control file uploads and file handling using Drupal 7's new field-based paradigm. Having fine grained control over how various files are accessed is a great improvement over past incarnations of Drupal.

Tuesday, April 24, 2012

Workbench: Managing Content Management-1

This screencast is a part of the Workbench learning series. You can find more at the following links:
* NodeOne Drupal Learning Library: nodeone.se/learn-drupal
* The Workbench overview series: nodeone.se/node/1021
* The Workbench main project page: drupal.org/project/workbench

Thursday, April 19, 2012

30+ Essential Drupal Modules

The Big Three

"The big three" are important enough that they deserve a category of their own. Most drupal modules worth using have integrated with one of these three. Their importance simply can't be stressed enough.

  • Content Construction Kit (CCK) - Part of drupal 7; still a contrib in drupal 6. Allows you to define new content types (e.g. blog entry, event, or employee record...) and add "fields" to them. A field could be plain text, an image, a flash video, or whatever. You can also adjust how these fields display in the live view. No drupal install should be without this module.
  • Views - Broadly speaking, this module empowers non programmers to build dynamic streams of content displaying any number of fields. The content may come from nodes (a.k.a. content types and fields), users, system log entries, etc. You can display this stream in any number of formats including RSS feeds, tables, or just the vanilla view for a content type. You can also create pages or blocks -- its very tightly interwoven with drupal. Nearly every drupal module worth using is integrated with this module. Extremely powerful when used in combination with CCK.
  • Panels -

    I believe Panels + CCK & Views is a hint at what drupal will look like 3 years into the future. I had to change my pants after the first time I witnessed it. At a very simple level, you could think of it as a layout manager. Create a 1,2,3 column layout. Or a 3 column layout with a full width footer and header, and plop pieces of content in them -- say a view, a block, or a node. That description, however does not do it justice. Since version 3, its positioned itself as a replacement for drupal core's clunky block system. It can now override a node page, and can be used to place content all over the place. It also introduced a concept of contexts, selections rules, and relationships. These are concepts that deserve a series of blog posts, but lets just say its solving some of the weirdest, mind numbing, bug creating problems found in advanced websites. Ironically, I used to hate this module, but after version 3 I will defend its awesomeness to the death!

For Administration Sanity

  • Admin Menu - Quick Dropdown menu to all admin areas. Makes any setting only a click away, instead of 3 to 6 clicks away.
  • RootCandy - A theme specially designed for administration. Drupal 7 comes with an admin theme included, but this is still highly recommended in drupal 6.

Content and SEO

  • Pathauto - Automatically create human readable URLS from tokens. A token is a piece of data from content, say the author's username, or the content's title. So if you set up a blog entry to use tokens like [author-name]/[title] then a blog entry by "Phil Withersppon" titled "my great day" will be rewritten example.com/phil-witherspoon/my-great-day.
  • Printer, email, and PDF Versions - There are still people out there who prefer to print out content to read later. This module does just that, and also lets them send your content via email.
  • NodeWords - A very poorly named module that's great at letting you edit meta tags.
  • Page Title - Lets you set an alternative title for the tags and for the

    tags on a node.
  • Global Redirect - Enforces numerous well thought out SEO rules, for example since I don't use this module you could access my content at "http://www.nicklewis.org/node/1062". This module however will search for the alias and 301 to the proper URL http://www.nicklewis.org/40-essential-drupal-6-modules. (thanks Jeff!)
  • Path Redirect - Simple idea: make it easy to redirect from one path to another. Does a good job at it.
  • Taxonomy manager - Makes large additions, or changes to taxonomy really really easy and painless.
  • Node Import - Made it shockingly easy to import 2000 csv rows, tie rows to CCK fields (or locations), and even will file it under the right taxonomy terms in hierarchy so long as you plan ahead.

Navigation

  • Menu Block - Lets you split menus into separate blocks based on depth. Say you have a top level menu link "Articles" with sub menu links "Politics", "Technology", "lifestyle". This block would let you show the sub menus in the right sidebar, and the top level "article" as tabs in the header.
  • Taxonomy Menu - Automatically generate menu items for categories. Handles syncing between taxonomy and menus, and is ready to be used in conjunction with views or panels.
  • Custom Breadcrumbs - Set up custom breadcrumb paths for content so that every page doesn't just have a breadcrumb back to "home". (note: i've used menu_trails a lot too.)
  • Nice Menus - Drop down menus (for people who are into that kind of thing).

WYSIWYG Editors + Image Uploading

  • WYSIWYG API - The standard integration module.
  • CKEditor - Currently my favorite WYSIWYG editor. WYSIWYG API only supports CKEditor on its dev version (at the time of this writing). For the time being, I use this module instead of WYSIWYG api. Regardless, the rest of the world probably uses WYSIWYG api.
  • IMCE - File browser / image inclusion for WYSIWYG editors. CKeditor is integrated out of the box, WYSIWYG API implementations require a bridge module.

Video and Image Handling

  • Filefield - Base CCK file upload field. Useful on its own, but also required by other essential modules.
  • ImageAPI, ImageCache, Imagefield - These three work together. ImageAPI handles low level integration with server side image processing (e.g ImageMagick). ImageCache allows you to set up presets for automatic resizing, cropping, and a host of other operations you'll probably never need to use. ImageField then provides an upload field to a piece of content, which you can use imagecache presets to resize in the display. Imagefield is very well integrated with Views and CCK. The paintings on the right show a bunch of images automatically resized using this technique.
  • Lightbox2 - If you've set up your imagefields, lightbox2 lets you add another layer of options. For example, display image resized at 300px wide on the page, but blow it up to full size when clicked. Like Imagefield, lightbox 2 is well integrated with Views and CCK. Very powerful combination.
  • Embedded Media Field - Embed video and audio files from dozens of third party providers ranging from youtube, to services you've probably never heard of.

User Profile, Ratings & Notifications

  • Content Profile - The core profile module sort of sucks. This turns profiles into nodes allowing you all the options of views and CCK.
  • Voting API + Fivestar - The standard voting widget of Drupal.
  • Notifications - Provides the ability to send emails when someone comments, or replies to a comment. Has a host of other features.
  • Captcha + Recaptcha - Standard Antispam system. In use on this very site.

Stuff Marketers Will Love

  • Webform - We all know visitors love filling out forms. This module lets your marketing team create custom forms, and collect whatever info they want.
  • Google Analytics - Simple integration of drupal with google Analytics.
  • Service Links - Easy "share this" links for content. Supports digg, facebook, delicous and a bunch of other social web 2.0 services.

Events and Calendars

  • Date - CCK field for handling dates, and date ranges.
  • Calendar - Integrated and controlled by views.

Location and Mapping

  • Location - Standard API for collecting addresses and lat/long. Integrated with Views and CCK. Somewhat difficult to use, but its a somewhat difficult problem it solves.
  • Gmap - Display locations in GMap.

Ecommerce

For Developers

  • Devel - Offers an enormous amount of information for developers, including: theme template variables, and overrides, browsable data structures, and datasets for performance-tuning. Just the debug function dsm(); makes it worth the download.
  • Backup & Migrate -- Greatly eases the pain of moving changes from your local development environment to the live server and vice versa.
  • Drush - Its actually not really module, but a "Swiss army knife" set of tools that are run from a command line. One example command is "drush dl views": running it will automatically download the latest version of views and place it in the right drupal folder. 1 second command instead of a 1 minute process of downloading from drupal, uploading via FTP. There's many other commands that are just as useful.

Conlusion

Lists like this can be outdated within six months. Always be on the look out for better and better modules.

Sunday, April 1, 2012

How to Mirror Your WordPress Blog to Blogger


wp-to-bloggerCreating a mirror of your blog is a good way to backup your content. In the event that your blog/web host/domain went down, you know that there is another site that is still running, and serving the exact same content.

This tutorial shows you how to mirror your WordPress blog to Blogger.

Why Blogger?

There are plenty of free blog services out there, why choose Blogger? The reason is because Blogger is free and is owned by Google. In term of reliability and stability, it is the best. Since you are backing up your content, isn’t it logical to get it on the most reliable platform around?

Migrating your existing WP blog

The migration from WordPress to Blogger is easy. Log into your WordPress dashboard as Administrator. Go to “Tools -> Export”. Export all your WordPress posts/categories and settings to an xml file.

wp-export-data

Go to WordPress2Blogger site. Convert the wordpress.201x-xx-xx.xml to blogger-export.xmlfile.

Login to your Blogger account and go to “Settings -> Import Blog“. Upload the blogger-export.xml file and Import your whole WP blog in.

wp-blogger-import-blog

If everything goes well, all your previously published posts should now be imported into Blogger.

Update Blogger whenever you publish a post

Now that you have imported your previously published posts into Blogger, it’s time to configure your Blogger’s blog to auto-update itself whenever you publish a post in WP.

First, in Blogger, go to “Settings -> Email & Mobile“. Create a new secret email address. This will be the email address that you mail to publish your post. Remember to check the box “Publish emails immediately”. Once done, click “Save Settings”.

wp-blogger-posting-option

Next, I am going to assume that you are using feedburner.com to manage your WP feed, and you have activated the “Email Subscription” option. What you need to do is to subscribe yourself to your own mailing list (preferably with a Gmail address) so that Feedburner can email you whenever you publish a new post.

The last and final thing is to setup your email account to forward the feedburner mail to your Blogger Publish email. In Gmail, this can be done by setting up a forwarding email address and a filter.

That’s it. Whenever you publish a new post in your WP blog, it will be auto-updated on your Blogger blog as well.

What other ways do you use to mirror your WP blog to Blogger?

-------------------------

-------------------------

Instructions

Ever wanted to move your WordPress blogs over to Blogger? This site can aid in the process!

Instructions

  1. Login to your WordPress account and navigate to the Dashboard for the blog that you'd like to transfer to Blogger.
  2. Click on the Manage tab below the Blog name.
  3. Click on the Export link below the Manage tab.
  4. Download the WordPress WXR export file by clicking on Download Export File.
  5. Save this file to your local machine.
  6. Browse to that saved document with the form below and click Convert.

  7. Save this file to your local machine. This file will be the contents of your posts/comments from WordPress in a Blogger export file.
  8. Login to your Blogger or create a new user.
  9. Once logged in, click on the Create a Blog link from the user dashboard, and then click on the Import Blog Tool
  10. Follow the instructions and upload your Blogger export file when prompted.
  11. After completing the import wizard, you should have a set of imported posts from WordPress that you can now publish to Blogger. Have fun!
NOTE: This hosted application will only allow downloads smaller than 1MB.