<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
    <channel>
        <title>Adventures in Movable Type</title>
        <link>http://www.beausmith.com/mt/</link>
        <description>idea &#8594; reqs &#8594; specs &#8594; comps &#8594; wires &#8594; code &#8594; qa... ship it.</description>
        <language>en</language>
        <copyright>Copyright 2008</copyright>
        <lastBuildDate>Thu, 26 Jun 2008 11:41:29 -0800</lastBuildDate>
        <generator>http://www.sixapart.com/movabletype/</generator>
        <docs>http://www.rssboard.org/rss-specification</docs>
        
        <item>
            <title>Automating Movable Type Installation</title>
            <description><![CDATA[<p>Automation is awesome! This script I use to set up a new MT instance probably saves me 15-20 hours a year, that 2-3 workdays.</p>

<p>I use the below shell script to:</p>

<ul>
<li>checkout target release of MT</li>
<li>checkout addons (Packs [ProPack, MTCS, Enterprise], static files, &amp; Tristan Theme)</li>
<li>checkout addons themes (Tristan</li>
<li>issue <code>make</code></li>
<li>set up a static directory for the release</li>
<li>set permissions</li>
<li>create a <code>mt-config.cgi</code> file</li>
<li>and finally&#8230; open the release in TextMate</li>
</ul>

<p>If you have an suggested improvements, please comment below!</p>

<h2>Usage</h2>

<p>Simple command does the above</p>

<pre><code>$ makemt 41
</code></pre>

<p>Full command</p>

<pre><code>$ makemt target-release {local-dir} {addons-release}
</code></pre>

<p><strong>Note:</strong> If you are not using the addons (or don&#8217;t have access to them) you&#8217;ll need to comment out the portions of the script containing <code>addons_branch</code>.</p>

<h2>Script</h2>

<pre><code>#!/usr/bin/env sh

# setup a new MT release
function makemt ()
{
    # usage: makemt target_release local_release_dir addons_branch
    # example: makemt 40 r40
    # target_release = svn repo name
    # local_release_dir = local release dir to place this repo
    target=${1};
    local_release_dir=${2};
    if [ ! $local_release_dir ]; then
        local_release_dir=$target;
    fi
    addons_branch=${3};
    if [ ! $addons_branch ]; then
        addons_branch="cal";
    fi
    if [ $target ]; then
        echo $target $local_release_dir $addons_branch;

        svn co http://code.sixapart.com/svn/movabletype/branches/release-$target /Sites/_live/cgi/release-$local_release_dir;
        echo SUCCESS: release-$target checked out;

        cd /Sites/_live/cgi/release-$local_release_dir;
        make;
        echo SUCCESS: make;

        mkdir /Sites/_live/html/r$local_release_dir;
        echo SUCCESS: created /Sites/_live/html/r$local_release_dir;

        chmod 777 /Sites/_live/html/r$local_release_dir;
        echo SUCCESS: permissions updated /Sites/_live/html/r$local_release_dir;

        cd /Sites/_live/html/r$local_release_dir;
        ln -s /Sites/_live/cgi/release-$local_release_dir/mt-static /Sites/_live/html/r$local_release_dir/mt-static;
        echo SUCCESS: symlink to /Sites/_live/html/r$local_release_dir/mt-static;

        chmod -R 777 /Sites/_live/cgi/release-$local_release_dir/mt-static/support;
        echo SUCCESS: permissions updated /Sites/_live/cgi/release-$local_release_dir/mt-static/support;

        cd /Sites/_live/cgi/release-$local_release_dir/;
        svn co http://svn.sixapart.com/repos/eng/mtaddons/branches/$addons_branch/addons/;
        echo SUCCESS: svn co $addons_branch/addons;

        svn co http://svn.sixapart.com/repos/eng/mtaddons/branches/$addons_branch/mt-static/addons mt-static/addons;
        echo SUCCESS: svn co $addons_branch/mt-static/addons;

        svn co http://svn.sixapart.com/repos/eng/mtaddons/branches/$addons_branch/mt-static/themes/tristan-blue mt-static/themes/tristan-blue;
        echo SUCCESS: svn co $addons_branch/mt-static/themes/tristan-blue;

        curl http://svn.sixapart.com/repos/eng/mtaddons/branches/$addons_branch/mt-cp.cgi &gt; mt-cp.cgi;
        echo SUCCESS: svn co $addons_branch/mt-cp.cgi;

        chmod 755 mt-cp.cgi
        echo SUCCESS: chmod 755 mt-cp.cgi;

        mt_config="# Config File Generated via makemt command
CGIPath /cgi-bin/release-$target/
StaticWebPath /r$target/mt-static

ObjectDriver DBI::mysql
Database mt_r21
DBUser root
DBPassword root
DBHost localhost
#DBSocket /Applications/MAMP/tmp/mysql/mysql.sock

##### CGI LOCATIONS #####
# AdminScript mt.fcgi
# CommentScript mt-comments.fcgi
# TrackbackScript mt-tb.fcgi
# ActivityFeedScript mt-feed.fcgi
# XMLRPCScript mt-xmlrpc.fcgi
# AtomScript mt-atom.fcgi
# UpgradeScript mt-upgrade.fcgi

DebugMode 1
DeleteFilesAtRebuild 1
# HTTPTimeout 60
# EnableAddressBook 1
# ShowIPInformation 1";
        echo "$mt_config" &gt; mt-config.cgi;
        echo SUCCESS: mt-config.cgi created;

        mate /Sites/_live/cgi/release-$local_release_dir/;
        mate /Sites/_live/cgi/release-$local_release_dir/mt-config.cgi;
    else
        echo 'usage = makemt target local_release_dir addons_branch';
    fi
}
</code></pre>
]]></description>
            <link>http://www.beausmith.com/mt/2008/06/automating-movable-type-installation.php</link>
            <guid>http://www.beausmith.com/mt/2008/06/automating-movable-type-installation.php</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Tips &amp; Tricks</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">code</category>
            
            
            <pubDate>Thu, 26 Jun 2008 11:41:29 -0800</pubDate>
        </item>
        
        <item>
            <title>Enabling FastCGI on Movable Type 4.x</title>
            <description><![CDATA[<p>Getting FastCGI configured and running can be a pain. There are <a href="http://www.movabletype.org/documentation/administrator/maintenance/fastcgi.html">FastCGI instructions</a> on <a href="http://www.movabletype.org/">MovableType.org</a>, but the page is so long that it looks kinda daunting.</p>

<p><a href="http://strangecode.com">Strangecode</a> has got FastCGI enabled for all hosting <a href="http://strangecode.com/accounts/">accounts</a>. So after installing Movable Type all I had to do to was the following two steps:</p>

<ol>
<li><p>Create symlinks to the primary MT scripts with names ending in .fcgi.</p>

<pre><code>$ cd /PATH/TO/MT
$ for F in mt{,-comments,-search}.cgi; do ln -s $F $(basename $F .cgi).fcgi; done
</code></pre></li>
<li><p>Add these lines to mt-config.cgi.</p>

<pre><code>AdminScript mt.fcgi
CommentScript mt-comments.fcgi
SearchScript mt-search.fcgi
</code></pre></li>
</ol>
]]></description>
            <link>http://www.beausmith.com/mt/2008/06/enabling-fastcgi-on-movable-type-4x.php</link>
            <guid>http://www.beausmith.com/mt/2008/06/enabling-fastcgi-on-movable-type-4x.php</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Tips &amp; Tricks</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">FastCGI</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">performance</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">tips</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">tricks</category>
            
            <pubDate>Tue, 03 Jun 2008 14:43:55 -0800</pubDate>
        </item>
        
        <item>
            <title>Advanced Archive Widget</title>
            <description><![CDATA[<p><span class="mt-enclosure mt-enclosure-image" style="display: inline;"><img alt="Anil Archives" src="http://www.beausmith.com/mt/assets/anil-archives.gif" width="361" height="254" class="mt-image-right" style="float: right; margin: 0 0 20px 20px;" /></span>Mie has been blogging every month <a href="http://kokochi.com/archives/2003/09/where_do_i_start.shtml">since 2003</a> on <a href="http://kokochi.com">kokochi.com</a>, the list of 57 monthly archives in her sidebar was getting really long.</p>

<p>Mie asked if I could add an archive widget to her blog&#8217;s sidebar like the one Anil sports on <a href="http://dashes.com/anil/">dashes.com</a>. After looking at the source <code>HTML</code> I realized that coding it in <code>MTML</code> was gonna be kinda complex. In <code>MTML</code> typically for each year in your archives you&#8217;d list all the months, but&#8212;because of the way that <code>html</code> tables are built&#8212;I&#8217;d need to list all the months for each year. For example, I need to list all the Jan archives, then all the Feb archives, etc. etc.)</p>

<p>So I asked Anil for his code. Doh! He admitted he was manually updating it. =P</p>

<p><span class="mt-enclosure mt-enclosure-image" style="display: inline;"><img alt="mie-archives.gif" src="http://www.beausmith.com/mt/assets/mie-archives.gif" width="241" height="238" class="mt-image-right" style="float: right; margin: 0 0 20px 20px;" /></span>I mentioned this to <a href="http://bradchoate.com/">Brad</a>, and he got so excited that he wrote a rough draft. I added the code to the sidebar on Kokochi.com, but the code wasn&#8217;t working. =/ After some testing, I realized that there were a few limitations (year&#8217;s w/o posts, and the inability to output the month as a number w/o a &#8220;0&#8221; prefix on single digit months), but then after consulting with Brad, solutions were found!</p>

<p>Follow the below code and you too can have this advanced archive table widget as seen on <a href="http://kokochi.com">kokochi.com</a> and <a href="http://dashes.com/anil">dashes.com/anil</a>.</p>

<h3>The MTML Code</h3>

<pre><code>&lt;table id="archives-table"&gt;
&lt;mt:ArchiveList type="Yearly" sort_order="ascend"&gt;
    &lt;mt:ArchiveListHeader&gt;&lt;tr&gt;&lt;$mt:ArchiveDate format="%Y" setvar="start_year"$&gt;&lt;/mt:ArchiveListHeader&gt;
    &lt;th&gt;&lt;$mt:ArchiveDate format="'%y"$&gt;&lt;/th&gt;
    &lt;$mt:ArchiveDate format="%Y" setvar="year"$&gt;
    &lt;$mt:setvar name="is_posts_year_{$year}" value="1"$&gt;
    &lt;mt:ArchiveList type="Monthly"&gt;
        &lt;$mt:ArchiveDate format="%m_%Y" setvar="month_year"$&gt;
        &lt;mt:SetVarBlock name="links_{$month_year}"&gt;&lt;a href="&lt;$MTArchiveLink$&gt;"&gt;&lt;mt:ArchiveDate format="%b"$&gt;&lt;/a&gt;&lt;/mt:SetVarBlock&gt;
    &lt;/mt:ArchiveList&gt;
    &lt;mt:ArchiveListFooter&gt;&lt;/tr&gt;&lt;$mt:ArchiveDate format="%Y" setvar="end_year"$&gt;&lt;/mt:ArchiveListFooter&gt;
&lt;/mt:ArchiveList&gt;
&lt;mt:for var="month" from="1" to="12"&gt;
    &lt;tr&gt;
    &lt;mt:for var="year" from="$start_year" to="$end_year"&gt;
        &lt;mt:if name="is_posts_year_{$year}"&gt;
            &lt;mt:setvarblock name="month_year"&gt;&lt;mt:var name="month" sprintf="%02d"&gt;_&lt;mt:var name="year"&gt;&lt;/mt:setvarblock&gt;
        &lt;td&gt;&lt;$mt:var name="links_{$month_year}" default="&amp;nbsp;"$&gt;&lt;/td&gt;
        &lt;/mt:if&gt;
    &lt;/mt:for&gt;
    &lt;/tr&gt;
&lt;/mt:for&gt;
&lt;/table&gt;
</code></pre>

<h3>The Code Explained</h3>

<p>Here&#8217;s a play-by-play on the <code>MTML</code> code used to produce this list&#8230;</p>

<p>Open the table.</p>

<pre><code>&lt;table id="archives-table"&gt;
</code></pre>

<p>List yearly archives in an ascending order (2001, 2002, 2003, etc).</p>

<pre><code>&lt;mt:ArchiveList type="Yearly" sort_order="ascend"&gt;
</code></pre>

<p>Open the TR; set the $start_year variable.</p>

<pre><code>    &lt;mt:ArchiveListHeader&gt;&lt;tr&gt;&lt;$mt:ArchiveDate format="%Y" setvar="start_year"$&gt;&lt;/mt:ArchiveListHeader&gt;
</code></pre>

<p>Output the two-digit year in a TD.</p>

<pre><code>    &lt;th&gt;&lt;$mt:ArchiveDate format="'%y"$&gt;&lt;/th&gt;
</code></pre>

<p>Set $year variable with the current year in the archive list.</p>

<pre><code>    &lt;$mt:ArchiveDate format="%Y" setvar="year"$&gt;
</code></pre>

<p>Set $is_posts_year_$year using year variable set above. This is a boolean variable that determines if there are posts within the year in context.</p>

<pre><code>    &lt;$mt:setvar name="is_posts_year_{$year}" value="1"$&gt;
</code></pre>

<p>List monthly archives for the current year.</p>

<pre><code>    &lt;mt:ArchiveList type="Monthly"&gt;
</code></pre>

<p>Set the $month_year variable after removing the &#8220;0&#8221; from the front of the month if it exists (eg. 1_2005, 2_2005 &#8230; 12_2005).</p>

<pre><code>        &lt;$mt:ArchiveDate format="%m_%Y" regex_replace="/^0/","" setvar="month_year"$&gt;
</code></pre>

<p>Set the links_$month_year variable. This variable name is dynamically set using the $month_year var set above. The value will be a month linked to the correct archive (eg. <code>&lt;a href="http://kokochi.com/archives/2004/05/"&gt;May&lt;/a&gt;</code>).</p>

<pre><code>        &lt;mt:SetVarBlock name="links_{$month_year}"&gt;&lt;a href="&lt;$MTArchiveLink$&gt;"&gt;&lt;mt:ArchiveDate format="%b"$&gt;&lt;/a&gt;&lt;/mt:SetVarBlock&gt;
</code></pre>

<p>Close monthly archive list.</p>

<pre><code>    &lt;/mt:ArchiveList&gt;
</code></pre>

<p>Close the TR. Set the $end_year variable.</p>

<pre><code>    &lt;mt:ArchiveListFooter&gt;&lt;/tr&gt;&lt;$mt:ArchiveDate format="%Y" setvar="end_year"$&gt;&lt;/mt:ArchiveListFooter&gt;
</code></pre>

<p>Close the yearly archive list.</p>

<pre><code>&lt;/mt:ArchiveList&gt;
</code></pre>

<p>For months 1 thorugh 12 do the following.</p>

<pre><code>&lt;mt:for var="month" from="1" to="12"&gt;
</code></pre>

<p>Open TR.</p>

<pre><code>    &lt;tr&gt;
</code></pre>

<p>Loop through the years between $start_year and $end_year.</p>

<pre><code>    &lt;mt:for var="year" from="$start_year" to="$end_year"&gt;
</code></pre>

<p>If there is posts in the current year, then continue.</p>

<pre><code>        &lt;mt:if name="is_posts_year_{$year}"&gt;
</code></pre>

<p>Set the $month_year variable using the $month and $year variables from the above for loops.</p>

<pre><code>            &lt;mt:setvarblock name="month_year"&gt;&lt;mt:var name="month"&gt;_&lt;mt:var name="year"&gt;&lt;/mt:setvarblock&gt;
</code></pre>

<p>Use the $month_year variable to output the links_$month_year set in the archive lists above.</p>

<pre><code>        &lt;td&gt;&lt;$mt:var name="links_{$month_year}" default="&amp;nbsp;"$&gt;&lt;/td&gt;
</code></pre>

<p>Close all the <code>MTML</code> loops,  <code>MTML</code> conditionals, and  <code>HTML</code> tags.</p>

<pre><code>        &lt;/mt:if&gt;
    &lt;/mt:for&gt;
    &lt;/tr&gt;
&lt;/mt:for&gt;
&lt;/table&gt;
</code></pre>

<h3>Scaleable?</h3>

<p>As long as your sidebar is wide enough, you&#8217;ll have room for this widget as it get&#8217;s wider. But by hacking the above code it shouldn&#8217;t be to hard to break the table into two vertically stacked tables or add some javascript to produce a solution involving hiding/showing of content.</p>

<p>If you hack the above, I&#8217;d love to hear about it.</p>

<p>Enjoy.</p>

<p>And thx again to Brad Choate, Mie Yaginuma, and Anil Dash for the instigation and assistance to produce this advanced example of <code>MTML</code>.</p>
]]></description>
            <link>http://www.beausmith.com/mt/2008/05/advanced-archive-widget.php</link>
            <guid>http://www.beausmith.com/mt/2008/05/advanced-archive-widget.php</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">code</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">advanced</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">code</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">movable type</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">mtml</category>
            
            <pubDate>Thu, 29 May 2008 13:23:16 -0800</pubDate>
        </item>
        
        <item>
            <title>Movable Type Bleeding Edge Updates Via Subversion</title>
            <description><![CDATA[<p>Follow these steps to easily switch between versions of Movable Type.</p>

<h3>Requirements</h3>

<ul>
<li>Subversion - Movable Type development is kept in a version control system called Subversion. Subversion allow many developers to work on the same code at the same time.</li>
<li>shell access - I use Terminal.app on my MacBook Pro.</li>
</ul>

<h3>Development Branches</h3>

<p>There is a branch for each development cycle. These branches are worked on for 1-3 weeks, before a branch is closed and passed to QA for testing. If QA finds any bugs, then bugs are fixed in the branch. All subsequent features are implemented in the next branch sequentially. The branch with the highest number is the most current release (as of this writing, release-35)</p>

<ul>
<li><a href="http://code.sixapart.com/svn/movabletype/branches/" title="Movable Type Branches">http://code.sixapart.com/svn/movabletype/branches/</a></li>
</ul>

<h3>Stable Tags</h3>

<p>Once a particular place in development is tested and approved for release the code at that point is tagged with a release number. </p>

<ul>
<li>
<a href="http://code.sixapart.com/svn/movabletype/tags/" title="Movable Type Stable Tags">http://code.sixapart.com/svn/movabletype/tags/</a></li>
</ul>

<h3>Checkout the Code</h3>

<p>These steps will be a little different based upon the setup of the web hosting environment. Here&#8217;s a simplified example of how I set-up Movable Type:</p>

<pre><code>www.beausmith.com/
    cgi/
        release-33/
        release-34/
        mt  -&gt; release-34
        mt4.01
        mt4.11
    html/
        blog/
            (archives here)
        index.php
        mt-static -&gt; ../../cgi/mt/mt-static
</code></pre>

<p>The items with the arrow <code>-&gt;</code> are symlinks. These allow me to not have to change urls when I update to a new release and also allow me to keep my mt-static directory inside the release folder. When I want to update to release-35, here&#8217;s the steps I&#8217;ll take:</p>

<ol>
<li><p>Navigate to the <code>cgi</code> directory &amp; use the subversion checkout command to get the latest version:</p>

<pre><code>$ pwd;
/www.beausmith.com
$ cd cgi;
$ svn co http://code.sixapart.com/svn/movabletype/branches/release-35;
</code></pre></li>
<li><p>Issue the make command to build the current release</p>

<pre><code>$ make;
</code></pre></li>
<li><p>Make the support files writeable</p>

<pre><code>$ chmod -R 777 release-35/mt-static/support
</code></pre></li>
<li><p>Remove the current symlink and create a new symlink to point to your release branch. I do this in the same step so as to avoid any potential downtime while switching. </p>

<pre><code>$ rm mt; ln -s release-35 mt;
</code></pre></li>
</ol>

<p>That&#8217;s it! Go access you MT installation.</p>

<h3>Updating</h3>

<p>Since changes will be committed round the clock by the MT teams in San Francisco and Japan, you&#8217;ll want to update often to get the latest changes.</p>

<pre><code>    $ cd cgi/release-35;
    $ svn up;
    $ make;
</code></pre>

<p>Doing a <code>make</code> is not necessary unless there are *.pre files that need to be rendered for the current language.</p>

<p><strong>Note:</strong> If you make changes to the files in the MT code, they may conflict with the updated code. Look forward to a future article about Subversion basics.</p>

<h3>Switching Between Movable Type Installs</h3>

<p>Is there a bug in release-35 and you want to go back to the stable mt4.11 install? Easy. Remove the <code>mt</code> symlink and then create a new one pointing to the desired MT install:</p>

<pre><code>    $ rm mt; ln -s mt4.11 mt;
</code></pre>

<h3>View Changes &amp; Code Diffs with Trac</h3>

<p>Trac also makes it easy to browse through all the recent changes to any branch of Movable Type. Note the similarity &amp; differences in the urls</p>

<ul>
<li>trac: http://code.sixapart.com/trac/movabletype/browser/branches/release-35/</li>
<li>svn: http://code.sixapart.com/svn/movabletype/branches/release-35/</li>
</ul>

<p>Questions? Please comment below.</p>
]]></description>
            <link>http://www.beausmith.com/mt/2008/04/movable-type-bleeding-edge-updates-via-subversion.php</link>
            <guid>http://www.beausmith.com/mt/2008/04/movable-type-bleeding-edge-updates-via-subversion.php</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Tips &amp; Tricks</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">code</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">bleeding edge</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">code</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">release</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">stable</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">svn</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">tag</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">trac</category>
            
            <pubDate>Mon, 14 Apr 2008 20:03:25 -0800</pubDate>
        </item>
        
        <item>
            <title>Adding Custom Styles for a Single Entry in Movable Type</title>
            <description><![CDATA[<p><style type="text/css">
#entry-55 ul li { color: blue; }
</style></p>

<p>The first three lines of this entry&#8217;s content is:</p>

<pre><code>&lt;style type="text/css"&gt;
#entry-55 ul li { color: blue; }
&lt;/style&gt;
</code></pre>

<p>Are the items in this unordered list blue?</p>

<ul>
<li>blue</li>
<li>blue</li>
<li>blue</li>
</ul>

<p>If so, I&#8217;ve added custom styles to this single entry.</p>

<ol>
<li>Create your entry</li>
<li>Save it as draft</li>
<li><p>Look in the url of your browser to find the <code>id</code> which is a unique <strong>id</strong>entifier for the entry (careful not to use blog_id as that is a unique id for the blog)</p>

<pre><code>http://www.chezbeau.com/cgi-bin/mt/mt.cgi?__mode=view&amp;_type=entry&amp;id=55&amp;blog_id=2&amp;saved_changes=1
</code></pre></li>
<li><p>Enter the id into your css</p></li>
<li>Change Status to Published</li>
<li>Save your entry</li>
</ol>

<p>All this assumes you are using the default templates from MT, if not you&#8217;ll have to add <code>&lt;$mt:EntryID$&gt;</code> to a container wrapping each entry in your templates.</p>
]]></description>
            <link>http://www.beausmith.com/mt/2008/04/adding-custom-styles-for-a-single-entry-in-movable-type.php</link>
            <guid>http://www.beausmith.com/mt/2008/04/adding-custom-styles-for-a-single-entry-in-movable-type.php</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Tips &amp; Tricks</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">css</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">design</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">entry</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">inline</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">style</category>
            
            <pubDate>Mon, 14 Apr 2008 13:50:53 -0800</pubDate>
        </item>
        
        <item>
            <title>Default Upload Destination in Movable Type</title>
            <description><![CDATA[<p>By default, assets are placed in the site root as defined in the publishing settings. For example, if the site root was <code>http://beausmith.com/</code> then the asset <code>image.gif</code> would be uploaded to <code>http://beausmith.com/image.gif</code>.</p>

<p>There are two common ways to change this:
1. Define a default upload destination folder.
2. Hard code upload destination and hide it from the form.</p>

<h2>1. Define a default upload destination folder</h2>

<p>To pre-populate the folder where assets will be placed add this line to the top of <code>MT_BASE/tmpl/cms/include/asset_upload.tmpl</code> and replace &#8220;assets&#8221; with your preferred folder name:</p>

<pre><code>&lt;$mt:setvar name="extra_path" value="assets"$&gt;
</code></pre>

<p>I use &#8220;assets&#8221; because this is the most generic word to describe all the things that could be placed in this folder: photos, video, documents etc.</p>

<h2>2. Hard code upload destination and hide it from the form</h2>

<p>Open <code>MT_BASE/tmpl/cms/include/asset_upload.tmpl</code> and search for this code (from MT4.0, code from MT4.1.x has a big chunk of javascript in the middle of the second <code>&lt;mtapp:setting&gt;</code> block, but the javascript can safely be removed as well):</p>

<pre><code>&lt;mt:setvarblock name="upload_hint"&gt;
    &lt;__trans phrase="_USAGE_UPLOAD" params="&lt;$mt:var name="blog_name" escape="html"$&gt;"&gt;
&lt;/mt:setvarblock&gt;
&lt;mtapp:setting
    id="folder"
    label_class="top-label"
    label="&lt;__trans phrase="Upload Destination"&gt;"
    hint="&lt;$mt:var name="upload_hint"$&gt;"
    show_hint="1"&gt;
    &lt;!-- &lt;$mt:var name="blog_url" escape="html"$&gt; --&gt;
    &lt;select name="site_path" onchange="setExtraPath(this)"&gt;
        &lt;option value="1"&gt;&amp;#60;&lt;__trans phrase="Site Root"&gt;&amp;#62;&lt;/option&gt;
    &lt;mt:if name="enable_archive_paths"&gt;
        &lt;option value="0"&lt;mt:if name="archive_path"&gt; selected="selected"&lt;/mt:if&gt;&gt;&amp;#60;&lt;__trans phrase="Archive Root"&gt;&amp;#62;&lt;/option&gt;
    &lt;/mt:if&gt;
    &lt;mt:if name="extra_paths"&gt;
        &lt;mt:loop name="extra_paths"&gt;
        &lt;option value="&lt;mt:if name="enable_archive_paths"&gt;0&lt;mt:else&gt;1&lt;/mt:if&gt;" middle_path="&lt;mt:var name="path" escape="html"&gt;"&lt;mt:if name="selected"&gt; selected="selected"&lt;/mt:if&gt;&gt;&lt;mt:var name="label" escape="html"&gt;&lt;/option&gt;
        &lt;/mt:loop&gt;
    &lt;/mt:if&gt;
    &lt;/select&gt;
    / &lt;input name="extra_path" id="extra_path" value="&lt;mt:var name="extra_path" escape="html"&gt;" /&gt;
&lt;/mtapp:setting&gt;
</code></pre>

<p>Replace the code with this code which will set the upload destination to <code>&lt;Site Root&gt;/assets/</code>:</p>

<pre><code>&lt;input type="hidden" name="site_path" id="site_path" value="1" /&gt;
&lt;input type="hidden" name="extra_path" id="extra_path" value="assets" /&gt;
</code></pre>

<p>The &#8220;Upload Destination&#8221; form elements should now be gone from the upload asset modal. </p>

<p><strong>Note:</strong> There are other ways to do this in the Perl code. It&#8217;d be nice to just have <a href="http://www.movabletype.org/documentation/appendices/config-directives/">config directives</a> to handle this.</p>
]]></description>
            <link>http://www.beausmith.com/mt/2008/04/default-upload-destination-in-movable-type.php</link>
            <guid>http://www.beausmith.com/mt/2008/04/default-upload-destination-in-movable-type.php</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Client Education</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">Tips &amp; Tricks</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">assets</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">mt4</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">tips</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">tricks</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">upload</category>
            
            <pubDate>Mon, 14 Apr 2008 13:10:28 -0800</pubDate>
        </item>
        
        <item>
            <title>Scrolling Preformatted Code Examples</title>
            <description><![CDATA[<p>I was adding more examples to the <a href="http://www.movabletype.org/documentation/">Movable Type Documentation site</a> today and my lines of code were so long that they went beyond the width of the column&#8230; so I implemented some css to use a scrollbar to display longer lines. Shorter lines display without the scrollbar.</p>

<h3>Examples (and HTML source)</h3>

<p>Short code renders no scroll bar&#8230;</p>

<pre><code>&lt;pre&gt;&lt;code&gt;short code example&lt;/code&gt;&lt;/pre&gt;
</code></pre>

<p>Long code renders scroll bar&#8230;</p>

<pre><code>&lt;pre&gt;&lt;code&gt;long code example (is it odd that the word "short" is longer that the word "long") long code example long code example&lt;/code&gt;&lt;/pre&gt;
</code></pre>

<h3>CSS Code</h3>

<pre><code>pre {
    overflow: auto;
    width: auto;
    background-color: #f0f6fa;
    border: 1px solid #CCCCCC;
    border-width: 1px 0;
    padding: 10px;
}
</code></pre>

<ul>
<li><code>overflow: auto;</code> - creates the scrollbar if content is wider than container.</li>
<li>`width: auto; - .</li>
<li><code>&lt;pre&gt;</code> &#8220;preformatted&#8221; &#8212; all the <strong>spaces and carriage returns</strong> are rendered exactly as you type them. All other formating (links, code, etc) are preserved.</li>
<li><code>&lt;code&gt;</code> tag renders in mono-spaced font.</li>
</ul>
]]></description>
            <link>http://www.beausmith.com/mt/2008/04/scrolling-preformatted-code-examples.php</link>
            <guid>http://www.beausmith.com/mt/2008/04/scrolling-preformatted-code-examples.php</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Tips &amp; Tricks</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">code</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">code</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">css</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">html</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">overflow</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">pre</category>
            
            <pubDate>Fri, 04 Apr 2008 16:19:38 -0800</pubDate>
        </item>
        
        <item>
            <title>Give Movable Type User System Admin Rights via MySQL</title>
            <description><![CDATA[<ol>
<li><p>login to mysql</p>

<pre><code>$ mysql -u USERNAME -p DATABASENAME
</code></pre></li>
<li><p>find id of user</p>

<pre><code>&gt; select author_name, author_id from mt_author;
+---------------+-----------+
| author_name   | author_id |
+---------------+-----------+
| beau          |         1 |
| quinn         |         2 |
| ryan          |         3 |
| jono          |         4 |
+---------------+-----------+
</code></pre></li>
<li><p>issue the command using the correct author id from the table</p>

<pre><code>&gt; update mt_author set author_is_superuser = 1 where author_id = 1;
</code></pre></li>
</ol>
]]></description>
            <link>http://www.beausmith.com/mt/2008/04/give-movable-type-user-system-admin-rights-via-mysql.php</link>
            <guid>http://www.beausmith.com/mt/2008/04/give-movable-type-user-system-admin-rights-via-mysql.php</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Tips &amp; Tricks</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">mysql</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">sysadmin</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">tips</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">tricks</category>
            
            <pubDate>Wed, 02 Apr 2008 17:14:21 -0800</pubDate>
        </item>
        
        <item>
            <title>Reset Password for Movable Type User via MySQL</title>
            <description><![CDATA[<ol>
<li><p>login to mysql</p>

<pre><code>$ mysql -u USERNAME -p DATABASENAME
</code></pre></li>
<li><p>find id of user</p>

<pre><code>&gt; select author_name, author_id from mt_author;
+---------------+-----------+
| author_name   | author_id |
+---------------+-----------+
| beau          |         1 |
| quinn         |         2 |
| ryan          |         3 |
| jono          |         4 |
+---------------+-----------+
</code></pre></li>
<li><p>issue the command using the correct author id from the table</p>

<pre><code>&gt; update mt_author set author_password = encrypt('foobar') where author_id = 1;
</code></pre></li>
</ol>
]]></description>
            <link>http://www.beausmith.com/mt/2008/04/reset-password-for-movable-type-user-via-mysql.php</link>
            <guid>http://www.beausmith.com/mt/2008/04/reset-password-for-movable-type-user-via-mysql.php</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Tips &amp; Tricks</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">mysql</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">password</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">reset</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">tips</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">tricks</category>
            
            <pubDate>Wed, 02 Apr 2008 16:55:42 -0800</pubDate>
        </item>
        
        <item>
            <title>Fastest Way to Login to Movable Type</title>
            <description><![CDATA[<p>I&#8217;m a keyboard short whore, feel me roar!</p>

<ol>
<li><strong>Enter username</strong> (shouldn&#8217;t have to tab as your cursor should already be there)</li>
<li><strong>Hit tab</strong></li>
<li><strong>Enter password</strong></li>
<li><strong>Control-R</strong> (access key to check the remember me checkbox)</li>
<li><strong>Control-S</strong> (access key for &#8220;submit&#8221; throughout the app)</li>
</ol>
]]></description>
            <link>http://www.beausmith.com/mt/2008/03/fastest-way-to-login-to-movable-type.php</link>
            <guid>http://www.beausmith.com/mt/2008/03/fastest-way-to-login-to-movable-type.php</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Tips &amp; Tricks</category>
            
            
            <pubDate>Fri, 28 Mar 2008 12:47:07 -0800</pubDate>
        </item>
        
        <item>
            <title>Firefox Shortcut to MT Docs</title>
            <description><![CDATA[<p>I visit the docs so often I made a Firefox shortcut for it.</p>

<p>To go to the docs for the tag <$mt:Entries$> I type the following into the location bar:</p>

<pre><code>docs entries
</code></pre>

<p>and then I&#8217;m redirected to:</p>

<pre><code>http://www.movabletype.org/documentation/appendices/tags/entries.html
</code></pre>

<p>BAM!</p>

<p>Here&#8217;s a screenshot of how you set it up. Basically you use %s to grab the string after the keyword.</p>

<p><span class="mt-enclosure mt-enclosure-image" style="display: inline;"><img alt="Firefox MT Docs Bookmark Shortcut" src="http://www.beausmith.com/mt/assets/ff-docs-bookmark.gif" width="509" height="240" class="mt-image-center" style="text-align: center; display: block; margin: 0 auto 20px;" /></span></p>
]]></description>
            <link>http://www.beausmith.com/mt/2008/03/firefox-shortcut-to-mt-docs.php</link>
            <guid>http://www.beausmith.com/mt/2008/03/firefox-shortcut-to-mt-docs.php</guid>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">docs</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">firefox</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">hack</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">shortcut</category>
            
            <pubDate>Thu, 20 Mar 2008 00:52:58 -0800</pubDate>
        </item>
        
        <item>
            <title>WTF is CGI-BIN MT MT CGI?  BAH!</title>
            <description><![CDATA[<blockquote>
  <p>What the f*ck is <code>cgi-bin mt mt cgi</code>?</p>
</blockquote>

<p>Apparently that doesn&#8217;t make sense Mr. Client.</p>

<p>So I updated his .htaccess file with this:</p>

<pre><code>Redirect /admin http://www.domain.com/cgi-bin/mt/mt.cgi?blog_id=1
</code></pre>

<p>Now he points his browser to <code>http://www.domain.com/admin</code> and he is redirected to his blog in his MT install.</p>

<p>Then he decided he didn&#8217;t want to type, just click&#8230; but didn&#8217;t want a link to &#8220;admin&#8221; visible on his site&#8230; so I made an invisible one.</p>

<p>So just after the date that appears on every entry in his blog, we linked a non-breaking space to his install:</p>

<pre><code>&lt;a href="http://www.domain.com/cgi-bin/mt/mt.cgi?blog_id=1"&gt;&amp;nbsp;&lt;/a&gt;
</code></pre>
]]></description>
            <link>http://www.beausmith.com/mt/2008/03/wtf-is-cgibin-mt-mt-cgi-bah.php</link>
            <guid>http://www.beausmith.com/mt/2008/03/wtf-is-cgibin-mt-mt-cgi-bah.php</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Client Education</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">client</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">hack</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">tips</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">tricks</category>
            
            <pubDate>Mon, 03 Mar 2008 09:05:46 -0800</pubDate>
        </item>
        
        <item>
            <title>Problems setting up TypeKey authentication</title>
            <description><![CDATA[<p>Enabling TypeKey authentication in the Feedback settings worked&#8230; but then when I went to my published post the link to &#8220;sign in&#8221; created an error on TypeKey. Saying:</p>

<blockquote>
  <p>The site you&#8217;re trying to comment on has not signed up for this feature. Please inform the site owner.</p>
</blockquote>

<h3>Solution</h3>

<p>Log into your TypeKey account and add a slash &#8220;/&#8221; after the end of your domain. So I changed:</p>

<blockquote>
  <p>http://www.chezbeau.com</p>
</blockquote>

<p>to</p>

<blockquote>
  <p>http://www.chezbeau.com/</p>
</blockquote>
]]></description>
            <link>http://www.beausmith.com/mt/2007/03/problems-setting-up-typekey-au.php</link>
            <guid>http://www.beausmith.com/mt/2007/03/problems-setting-up-typekey-au.php</guid>
            
            
            <pubDate>Fri, 02 Mar 2007 18:10:36 -0800</pubDate>
        </item>
        
    </channel>
</rss>
