When Wired refers to blogging as 'Opinion Journalism', you know you have
a full-blown trend in your hands. Weblogs or blogs are websites with a curious
but engaging mishmash of opinion, links and a whimsical 'me-centric' diary
entries. Encouraged by free online tools like LiveJournal and Blogspot, every
semi-geek and his sister have a blog. While most of these die out after the
first flush of enthusiasm wanes, some survive and a few of these even succeed in
building a loyal readership who check for updates and comments everyday.
If all you are looking for is a simple standard-template 'diary-on-the-web',
a free online account with Blogger or LiveJournal will do nicely.
|
But if you are a little more ambitious and want better control over the
features, layout, information architecture and want to integrate your blog's
notification with mail and SMS, then hosting your domain on a shared server
running your own copy of a blog publishing system is what you need. This article
series will discuss how to do this with two of the most popular Web publishing
systems-MovableType and WordPress.
MovableType was one of the first full-featured blog-management tools to come
on the scene. Written in Perl, it uses the slightly dated CGI technology at its
core. With some effort though, you can configure it to run using Apache's
mod_perl module.
However, with Version 3 onwards there has been significant work on using PHP
in an innovative way-in a way that would make MovableType a Web-publishing
solution that will generate the best mix of static and dynamic pages to optimize
loads on your server.
Before you go into the installation details, take some time to understand the
MT (MovableType) system and the way it generates your Web pages.
The main components of your publishing system are your content and a set of
templates. Both are loaded terms. Content not just means the raw words that make
it up, but also the metadata that describes it-categories, keywords and
classification.
On the other hand, template is not just a style template but a complete
information template that tells MovableType how to arrange the content on each
page. Once you understand the MovableType 'templating language' you will be
well on your way to being a MovableType guru that will allow you to build your
blog on an extremely complex and high-usability architecture.
MovableType's ability to implement arbitrarily complex information
architectures means that you cannot only use it for your blog but also for your
corporate blog or your Intranet since these are just different ways of arranging
content and a slightly different manner in which different 'content-chunks'
or articles hyperlink among themselves. But we are getting ahead of ourselves...
How it works
As we said earlier, content (including its metadata) and templates (semantic
information organization of a page) are the two basic components of the MT
system. The content lives in a database-you can use any of MySQL, PostgreSQL,
SQLLite or even a simple Berkeley DB type barebones database.
However, once you make a choice and configure your blog to use any one of
these, the entire database layer moves gracefully out of your view and you never
have to deal with it again. Even when you want to move from one server to
another or from one database to another, MT allows you to export and import the
blog's content (but not the templates) via text files making the database layer
completely transparent.
Since the time Version 3 was released over a year ago, MT has two kinds of
templates: Static templates and Dynamic templates. Static templates just read
and dump the content from the database as requested by the 'template tags'
in the template, generate the page and store this page on pre-configured
directory/folder of your Web server.
If the content or layout on a generated page does not change, MT does not
touch it again and your Web server can serve the same page to the client browser
any time a request for it comes in. If you change the content of that page, you
just rebuild that page once and it populates the tags in the template once again
to get a new version.
MovableType also has an intelligent system by which it can figure out when to
regenerate a page depending on the content changes (new article/section added,
old article edited etc) but if you do not trust MT's intelligence you can always
rebuild your entire website.
That was about MT's static templates. The dynamic templates, on the other
hand, work differently. If a page is linked to a dynamic template, MT first
converts the tags in the template into Smarty tags (see smarty articles for an
explanation of Smarty templating engine) and caches it in a separate directory
and then uses the Web server's PHP engine to render the page dynamically. The
details of this illustrate a great hack: If the Web server can resolve the
request to a physical file (generated by a static template), it will return the
appropriate file. On the other hand if the Web server cannot find the requested
page, it will respond to the request as configured in Apache's .htaccess file
created by MovableType and placed in the correct location.
This file instructs Apache to forward any request that cannot be resolved to
a physical file or directory to a special script (mtview. php) which pulls out
the dynamic template from the database, compiles it into a Smarty template and
passes it on to Apache's php handler.
Any repeat request for the same page will use Smarty's caching of the compiled
code to generate the page! If you don't understand the details of how this
works, don't worry.
The beauty of MovableType's rich interface keeps you extremely well insulated
from the gory internals and you can use dynamic templates without understanding
their precise details. For example, it generates the correct .htaccess file for
any dynamic template page. Don't just go looking for physical pages designated
as dynamic on your Web server. They don't exist except at best as compiled
Smarty templates ready to be handed over to Apache's PHP handler!
Installing MovableType
Installing MovableType is not very different from installing other Web
publishing systems and content management systems. MovableType provides a free
single-blog version for individual use. You need to register and then download
the source (either as zip or a UNIX friendly tarball). The following steps
should get your blog up and running:
- MovableType is a Perl CGI program. Though you can use PHP (and for some
neat functionality, PHP is a definite requirement) in your site, your Web
server must have Perl and CGI. In addition, MovableType works by generating
static pages (mostly!) so you must make sure that your Web server must have
write permissions on your folders. This is normally considered risky (though
its use is widespread on shared servers) and a good way to sidestep this
requirement is to use the secure cgi (scgi-bin) feature of Apache. With this
functionality, Apache for certain scripts in a special folder (normall scgi-bin
as opposed to the usual cgi-bin) runs the scripts as you, thereby
guaranteeing writes to your own folders.If your Web hosting provider uses
Cpanel and you have access to it, you can easily configure an scgi-bin
folder. In case you cannot make a special scgi-bin folder, use a usual cgi-bin
and allow the user Apache runs as, the permission to write to your folders. - MovableType requires a small set of Perl Modules installed. They are
CGI, HTML::Template, Image::Size, File:: Spec, CGI::Cookie, DBI and one of
DBI_File, DBD::Pg, DBD::mysql or DBD::SQLite depending on the database you
plan to use. We will assume that you use MySQL.
If any of these modules are not available on your Web server, you can
install them painlessly using the CPAN module (this module resolves any
dependency issues). Of course, if you are not permitted to install Perl
modules, you could request your hosting service to install it for you. In
any case, all Web servers I have worked with have the above core modules
installed so there is very little chance that you would have a problem on
this count. - MovableType works better if you have a few more optional modules
installed, HTML::Entities allows people to post formatted HTML comments,
SOAP::Lite allows your blog to provide feeds over a SOAP service,
Image::Magick allows you to automatically generate thumbnails of your images
(you can generate thumbnails yourself and upload them if you do not have
access to this module) and Crypt::DSA and MIME::Base64 allow you to generate
notifications easily. None of this is required of course. Just good to have! - Create a MySQL database and note the name of the database, the username to
connect as and the password. - Unzip the contents of the downloaded compressed archive on your local
drive. Create a folder (say 'mt') under your scgi-bin folder on the Web
server. Transfer all files except the folder called 'mt-static' under
the main folder on your local drive to the 'mt' folder online.
Ensure that all files with the CGI extension are executable by you (or the
Web server if you are using vanilla CGI). Make sure that you satisfy all the
module requirements by pointing your browser to the URL: http://www.mydomain.com/scgi-bin/mt/mtcheck.cgi.
Substitute www.mydomain.com with the correct domain name. This script will
generate a full compliance report and flag any missing modules. - Transfer the entire mt-static folder in your Web root or somewhere outside
your scgi-bin (or cgi-bin) directory but under your Web root where it is
accessible from the Web. - Edit the 'mt-config.cgi' (most ftp clients including gftp allow you to
edit a remote file 'in place') and fill in the appropriate values. The
configuration file is very well commented. Read each comment carefully
before making a change. If you understand how each folder on your remote
file system maps to a URL, you should have no difficulty at all. The most
important changes are the location (URL) of 'mt' folder and its name on
the local file system, the location and URL of the mt-static folder and the
database details. The rest are usually best kept at their default values. - Once you have correctly configured the parameters in 'mtconfig.cgi',
just point your browser to the URL
http://www.mydomain.com/scgi-bin/mt/mt.cgi.
This will connect to the database and populate it with all data required for
operations.
You are now ready to start a Weblog. If you want to set up a power blog with
a complex information design and layout, you must understand the MovableType
template tags and that is what we will do next month. But if the default blog
works great for you, then go write!