Build web site

Build an own community web-site. A samurai path. A tutorial on Drupal

Thursday, December 08, 2005

Cleaning the URLs

As you probably noticed, URLs of the default Drupal installation look like Not a big problem for search engines, but you can easily clean the URLs more to chage them into

1. Make sure that your site is hosted on Apache web server and your hoster enabled the mod_rewrite module. It is true for virtually all the cheap hosters (including my hoster). If you are not sure, ask your web-site support. It is a very simple and frequent question - they should be able to answer within 5 minutes.

2. If you installed your site in a domain subdirectry, i.e. it is visible like, Edit the .htaccess file in the root directory of your Drupal installation.
Uncomment "#RewriteBase /drupal" line by changing it into "RewriteBase /yoursite"

3. Go to your site's administer->settings and enable the "Clean URLs" option

Voila, if everything is ok, from now on you should see clean urls in the address bar, without any "?q="

I also enabled adding posting for the anonymous users, so you don't need to have an account to test the Drupal features. Come and try posting with the clean URLs yourself

Monday, December 05, 2005

Drupal tutorial plan

The follwoing topics will be covered soon:

1. WYSIWYG editor installation
2. Integration of the inline image upload and source code highlighting into WYSIWIG editor
3. Selecting and tuning the site template, theme and color scheme
4. Adding the AdSense

What has been covered already:
1. Drupal installation
2. Addition of the inline image upload feature
3. Source code highlighting installation. And part 2 here

Stay tuned

Sunday, December 04, 2005

Installing source code highlighting. Part 2

Codefilter module, we installed in the part 1 can be enhanced with the Generic Syntax Highlighter - GeSHi. With the GeSHi in action you can post to Drupal site really nicely coloured source-code.

1. Before applying the patch download the Geshi engine itself. (Link to the download page on the Sourceforge)

2. Upack it and upload everything, but contrib and docs directories to your site's modules/codefilter directory so that you had the following directory structure:
I am describing it in such a detail, because some people are really confused ending with the several enclosed directories with the same name

3. Download the latest version of the codefilter-geshi patch (Direct link to the version 4.6.0 from August 6 2005). Downloaded patch is in a special format created by the diff utility and supposed to be pathced by the patch utility (Generic Drupal instructions on creating and applying patches)

4. Update the patch to the codefilter directory

then log in to your server shell and apply the patch by running "patch
You could also apply patch on your Windows PC. For this, you'd have to locate the Windows version of the patch utility.

5. Go to admin->modules. Disable codefilter module and enable it back. This procedure will install the geshi-related settings into the settings menu

6. Visit the admin->settings->"Codefilter Config", enable the highlighting and select the default highlight language. It is c++ in the SymbianExample case

That's it now all your posted source code will be nicely formatted with the C++ language in mind. You can use any other language supported by geshi, by specifying it in the language argument. E.g. language="python". You can also turn autohighlighting for the particular code snipplet off by passing the highlight="false" argument. Note, that there should be no space before and after the "=" character.
Here's how the post source will be transormed into the nicely formatted output:

While the site is still under construction you are welcome try the feature yourself. Create an account on SymbianExample and post some code yourself.

The next step of the tutorial will be integration of the Rich Text editor, that will allow posting texts via almost Word interface.
Stay tuned

Saturday, December 03, 2005

Installing source code highlighting. Part 1

To add the source-code highlighting we will use the codefilter module and patch it with the geshi highlighting engine

Installing codefilter

Codefilter module formats everything between the <code></code> tags so that everything looks like nicely preformatted source code. Not that much, but we'll fix it with the Geshi coloring a bit later

Intalling codefilter is very strightforward:
1. Download the latest codefilter module (Direct link to the release 4.6.0 from 13/04/2005)

2. Copy it to your site "modules" directory

3. Visit administer->modules and enable the codefilter

4. Go to administer->"input formats" and enable codefilter in at least one input format. I did it in the default "Filtered HTML" only.

That's it, now whenever you create a new post you can surround the source code with the tags.

The resulting post will have a grey background and all the "<" and ">" characters will be displayed correctly

You are welcome to create an account on Symbian Example and try it yourself.

Next step in the web site creation will be enhancing the codefilter module to add the source code highlighting to it.

Stay tuned.