December 2008 Archives

Action Streams Easy Installation

| 1 Comment

I was installing Action Streams on Chris Alden’s r21.org and remembered that Mark Pascal showed me tip about installing Action Streams.

Instead of distributing all the files in the extlib directory in the sub-directories of the extlib directory in your MT install—as described in steps 3 of the Action Steams readme—Mark showed me that the Action Streams extlib directory can be placed in the Action Streams plugin directory.

When you download the Action Streams plugin, here are the files in the directory. Notice the location of the extlib directory:

ActionStreams-1.0/
    example_templates/
    extlib/
        HTML/
        HTTP/
        Web/
        XML/
    mt-static/
    plugins/
        ActionStreams/
            blog_tmpl/
            config.yaml
            lib/
            tmpl/
        Iwtst/

When you install Action Streams in your MT install, move the extlib directory under the Action Streams plugin directory:

MT_HOME/
    plugins/
        ActionStreams/
            blog_tmpl/
            config.yaml
            extlib/
                HTML/
                HTTP/
                Web/
                XML/
            lib/
            tmpl/

Clean URLs for Tag & String Searches

| 4 Comments

Because Movable Type is not always installed on servers where customers have access to the servers apache config or an .htaccess file, MT’s tag and string search urls look like:

Tag Search and String Search (respectively)

http://chezbeau.com/cgi-bin/mt/mt-search.fcgi?blog_id=1&tag=tomato&limit=20
http://chezbeau.com/cgi-bin/mt/mt-search.fcgi?search=tomato&IncludeBlogs=1&limit=20

These can easily be changed to more “clean” urls

http://chezbeau.com/tag/tomato
http://chezbeau.com/search/tomato

To convert your Movable Type powered site to use clean urls, follow these steps:

  1. Edit your .htaccess file and add the following lines

    RewriteEngine on
    RewriteRule ^tag/(.*)$ /cgi-bin/mt/mt-search.fcgi?blog_id=1&tag=$1&limit=20
    RewriteRule ^search/(.*)$ /cgi-bin/mt/mt-search.fcgi?search=$1&IncludeBlogs=1&limit=20
    

    The first line RewriteEngine on turns on the Rewriting Engine. The second and third lines use RewriteRule to map the desired urls to the actual urls.

  2. Update tag links in tag clouds and on entry details by replacing <$mt:TagSearchLink encode_js="1"$> with:

    <$mt:BlogURL$>tag/<$mt:TagName normalize="1"$>
    
  3. Update search form.

    This requires a few more invasive changes:

    1. add class search-form to the <form> element
    2. Include a link to jquery in your header. Use a local file or remotely hosted file like this one on Google:

      <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
      <script type="text/javascript">
      $(document).ready(function() {
          $('.search-form').submit(function() {
              window.location.href = "/search/" + $('.search-form input:text').val();
              return false;
          });
      });
      </script>
      

Notes: