<?xml version="1.0" encoding="utf-8"?>
<feed version="0.3" xmlns="http://purl.org/atom/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xml:lang="en">
<title>Movalog</title>
<link rel="alternate" type="text/html" href="http://www.movalog.com/" />
<modified>2005-02-01T12:27:59Z</modified>
<tagline>All things Movable Type</tagline>
<id>tag:www.movalog.com,2005://1</id>
<generator url="http://www.movabletype.org/" version="3.15">Movable Type</generator>
<copyright>Copyright (c) 2005, Arvind</copyright>
<entry>
<title>Feeds Burned</title>
<link rel="alternate" type="text/html" href="http://www.movalog.com/archives/announcements/feeds-burned.php" />
<modified>2005-02-01T12:27:59Z</modified>
<issued>2005-02-01T12:22:29Z</issued>
<id>tag:www.movalog.com,2005://1.1192</id>
<created>2005-02-01T12:22:29Z</created>
<summary type="text/plain">The link for the rss feed has now changed. I&apos;ve finally embraced Feedburner so that I can track stats etc (no ads yet don&apos;t worry). The new feed is located here. I have put permanent redirects onto the old rss...</summary>
<author>
<name>Arvind</name>

<email>arvind.2111@gmail.com</email>
</author>
<dc:subject>Announcements</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.movalog.com/">
<![CDATA[<p>The link for the rss feed has now changed. I've finally embraced Feedburner so that I can track stats etc (no ads yet don't worry). The new feed is located <a href="http://feeds.feedburner.com/Movalog">here</a>. I have put permanent redirects onto the old rss files (both combined and normal) to point to the new Feedburner feed. Most RSS readers will pick this up and update it accordingly. If not then manually change it if you wish to keep up to date. Sorry for the inconvenience. The link to the Planet Movable Type feeds will remain the same as I don't want to mess around with any tracking tools used by the sites that are aggregated!</p>
]]>

</content>
</entry>
<entry>
<title>PHP PreviousNextInCategory</title>
<link rel="alternate" type="text/html" href="http://www.movalog.com/archives/plugins/php-previousnextincategory.php" />
<modified>2005-02-01T06:14:07Z</modified>
<issued>2005-02-01T05:32:06Z</issued>
<id>tag:www.movalog.com,2005://1.1191</id>
<created>2005-02-01T05:32:06Z</created>
<summary type="text/plain"><![CDATA[I really liked Phil Rignalda's PreviousNextInCategory that would basically show the Previous/Next entries in the same category as the current entry (kinda like &lt;MTEntryPrevious&gt; and &lt;MTEntryNext&gt;) Unfortunately this plugin didn't work under the dynamic publishing system. So announcing PHP PreviousNextInCategory....]]></summary>
<author>
<name>Arvind</name>

<email>arvind.2111@gmail.com</email>
</author>
<dc:subject>Plugins</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.movalog.com/">
<![CDATA[<p>I really liked Phil Rignalda's <a href="http://philringnalda.com/blog/2004/02/previous_and_next_in_category.php">PreviousNextInCategory</a> that would basically show the Previous/Next entries in the same category as the current entry (kinda like &lt;MTEntryPrevious&gt; and &lt;MTEntryNext&gt;)</p>

<p>Unfortunately this plugin didn't work under the dynamic publishing system. So announcing PHP PreviousNextInCategory. There are two files in the zip file that will need to be uploaded to the php/plugins/ directory. The two files will provide the container tags &lt;MTEntryPreviousInCategory&gt; and &lt;MTEntryNextInCategory&gt; exactly like the perl version and are to be used in exactly the same way eg</p>

<blockquote>&lt;MTEntryPreviousInCategory&gt;
&lt;a href="&lt;$MTEntryPermalink$&gt;"&gt;&laquo; &lt;$MTEntryTitle$&gt;&lt;/a&gt; |&lt;/MTEntryPreviousInCategory&gt;<br />
&lt;a href="&lt;$MTEntryPermalink archive_type="Category"$&gt;"&gt;&lt;$MTEntryCategory$&gt;&lt;/a&gt;<br />
&lt;MTEntryNextInCategory&gt;
| &lt;a href="&lt;$MTEntryPermalink$&gt;"&gt;&lt;$MTEntryTitle$&gt; &raquo;&lt;/a&gt;
&lt;/MTEntryNextInCategory&gt;</blockquote>

<p>The plugin can be downloaded <a href="http://www.movalog.com/PHPPreviousNextInCategory.zip">here</a>. For those interested, the PHP files are more or less the PHP files for &lt;MTEntryPrevious&gt; and &lt;MTEntryNext&gt; with just code slotted in to check the category. </p>
]]>

</content>
</entry>
<entry>
<title>Password Protect Entries</title>
<link rel="alternate" type="text/html" href="http://www.movalog.com/archives/hacks/password-protect-entries.php" />
<modified>2005-01-28T15:46:25Z</modified>
<issued>2005-01-28T08:23:07Z</issued>
<id>tag:www.movalog.com,2005://1.1186</id>
<created>2005-01-28T08:23:07Z</created>
<summary type="text/plain"> One of the biggest wants with MT is to password protect individual entries. There are several hacks and bits of code that allow you to password protect entries but many of them are long winded and many involve separate...</summary>
<author>
<name>Arvind</name>

<email>arvind.2111@gmail.com</email>
</author>
<dc:subject>Hacks</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.movalog.com/">
<![CDATA[<div class="floatleft"><a href="http://www.movalog.com/password.php" onclick="window.open('http://www.movalog.com/password.php','popup','width=639,height=194,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="http://www.movalog.com/password_sm-thumb.png"/></a></div>

<p>One of the biggest wants with MT is to password protect individual entries. There are several hacks and bits of code that allow you to password protect entries but many of them are long winded and many involve separate categories. I wanted a simple way to selectively password protect entries no matter what the category, what blog etc. </p>

<p>So I created a new field on the entry screen (click screenshot for a larger view) that would contain the password. For this to work you will need to be using MT 3.1x, mySQL and PHP. To see this in action see the <a href="http://blog.arvind-satya.com/">front page on my blog</a>, enter the password "password" and you will be granted access for 10 days.</p>

<p>And yes I'm perfectly aware WordPress has this functionality built in!</p>
]]>
<![CDATA[<p>First off all run this query on your mysql database, all it does is add a new column called entry<em>password to your mt</em>entry table. </p>

<blockquote>Alter table mt_entry add column entry_password text</blockquote>

<p>Next open up lib/MT/App/CMS.pm and find around line 656</p>

<blockquote>                    $q-&gt;param($col) : $obj-&gt;$col();<br />
            }<br />
            if ($type eq 'entry') {</blockquote><br />

and add below it

<blockquote>                $param{password} = $obj-&gt;password;</blockquote>

<p>Save CMS.pm and open lib/MT/Entry.pm and right at the top you'll see the columns in the mt_entry table being defined. Find </p>

<blockquote>'basename',</blockquote>

<p>and replace it with</p>

<blockquote>'basename','password',</blockquote>

<p>Save Entry.pm. This next change we're going to make will create a new &lt;MTEntryPassword&gt; tag. Open up lib/MT/Template/Context.pm and search for</p>

<blockquote>    $ctx-&gt;register_handler(EntryMore =&gt; \&_hdlr_entry_more);</blockquote>

<p>and add immediately underneath it</p>

<blockquote>    $ctx-&gt;register_handler(EntryPassword =&gt; \&_hdlr_entry_password);</blockquote>

<p>Next find </p>

<blockquote>sub _hdlr_entry_title {</blockquote>

<p>and add immediately above it</p>

<blockquote>sub _hdlr_entry_password {<br />
    my $e = $_[0]-&gt;stash('entry')<br />
        or return $_[0]-&gt;_no_entry_error('MTEntryPassword');<br />
    my $password = defined $e-&gt;password ? $e-&gt;password: '';<br />
    $password;<br />
}</blockquote>

<p>Save Context.pm and open edit_entry.tmpl, find </p>

<blockquote>&lt;TMPL_VAR NAME=CREATED_ON_FORMATTED ESCAPE=HTML&gt;<br />
&lt;/TMPL_IF&gt;</blockquote>

<p>and add underneath it</p>

<blockquote>&lt;br /&gt;<br />
&lt;label&gt;&lt;MT_TRANS phrase="Entry Password"&gt;&lt;/label&gt;&lt;br /&gt;<br />
&lt;input name="password" id="password" value="&lt;TMPL_VAR NAME=PASSWORD&gt;" /&gt;<br /></blockquote>

<p>Save edit_entry.tmpl and upload these files. Next you'll need to create a new static index template called mt-password.php. For the template body, copy the contents of <a href="http://www.movalog.com/mt-pass.txt">this file</a>. The file sets a cookie that lasts 10 days. To change the length it lasts, change 864000 to another time frame in seconds, for example a day would be 86400 etc.</p>

<p>Save and rebuild the template. </p>

<p>This next bit depends on whether you publish statically or dynamically. I'll walk you through both ways.</p>

<p><strong>Static Publishing</strong></p>

<p>At the top of all templates where you use &lt;MTEntry&gt; tags, add the following</p>

<blockquote>&lt;?php<br />
    include('&lt;$MTCGIServerPath$&gt;/php/mt.php');<br />
    $mt = new MT(&lt;$MTBlogID$&gt;, '&lt;$MTCGIServerPath$&gt;/mt.cfg');<br />
$db = $mt-&gt;db(); ?&gt;</blockquote>

<p>This must be added right at the top, before the DocType declaration. </p>

<p>Next, just before the &lt;MTEntryBody&gt; tag, add this</p>

<blockquote>&lt;?<br />
$pass = $db-&gt;get_var("select entry_password from mt_entry where entry_id = &lt;MTEntryID&gt;");<br />
$cookie = 'mt-postpass_'.md5($pass);<br />
if($pass == "" || isset($_REQUEST[$cookie]) ) { ?&gt;</blockquote>

<p>Finally just before the posted section add</p>

<blockquote>&lt;? } else { ?&gt;<br />
&lt;form action="&lt;MTBlogURL&gt;mt-password.php" method="post"&gt;<br />
&lt;input name="entry_id" value="&lt;MTEntryID&gt;" type="hidden" /&gt;<br />
    &lt;p&gt;This post is password protected. To view it please enter your password below:&lt;/p&gt;<br />
    &lt;p&gt;&lt;label&gt;Password:&lt;/label&gt; &lt;input name="post_password" type="text" size="20" /&gt;<br /> &lt;input type="submit" name="Submit" value="Submit" /&gt;&lt;/p&gt;<br />
    &lt;/form&gt;<br />
&lt;? } ?&gt;</blockquote>

<p>For the RSS templates, you'll need to do something slightly different. Wherever you find an &lt;MTEntryBody&gt; tag, replace it with </p>

<blockquote>&lt;MTIfEqual a="[MTEntryPassword]" b=""&gt;&lt;$MTEntryBody encode_xml="1"$&gt;&lt;/MTIfEqual&gt;&lt;MTIfNotEqual a="[MTEntryPassword]" b=""&gt;This post is password protected.&lt;/MTIfNotEqual&gt;</blockquote>

<p>To make this work, you'll need to install the <a href="http://mt-plugins.org/archives/entry/compare.php">Compare</a> plugin</p>

<p>Rebuild all the files. To password protect an entry, type in a password into the Entry Password field on the edit/new entry page and once the pages are rebuilt, readers will need to enter a password to be able to gain access to the entry. </p>

<p><strong>Dynamic publishing</strong></p>

<p>With dynamic publishing, things are slightly easier since we're already in a PHP environment. In all templates that call &lt;MTEntry&gt; tags, add this right above the &lt;MTEntryBody&gt; tag</p>

<blockquote>&lt;?php<br />
$entry = $this-&gt;stash('entry'); <br />
$pass = $entry['entry_password'];<br />
$cookie = 'mt-postpass_'.md5($pass);<br />
if($pass == "" || isset($_REQUEST[$cookie]) ) { ?&gt;</blockquote>

<p>and add this right above the posted section</p>

<blockquote>&lt;?php } else { ?&gt;<br />
&lt;form action="&lt;MTBlogURL&gt;test.php" method="post"&gt;<br />
&lt;input name="entry_id" value="&lt;MTEntryID&gt;" type="hidden" /&gt;<br />
    &lt;p&gt;This post is password protected. To view it please enter your password below:&lt;/p&gt;<br />
    &lt;p&gt;&lt;label&gt;Password:&lt;/label&gt;&lt;input name="post_password" type="text" size="20" /&gt;<br /> &lt;input type="submit" name="Submit" value="Submit" /&gt;&lt;/p&gt;<br />
    &lt;/form&gt;<br />
&lt;?php } ?&gt;</blockquote>

<p>The RSS templates are slightly different. Replace the &lt;MTEntryBody&gt; tag with</p>

<blockquote>&lt;?php<br />
$entry = $this-&gt;stash('entry'); <br />
$pass = $entry['entry_password'];<br />
if($pass == "") { ?&gt;&lt;$MTEntryBody encode_xml="1"$&gt;<br />&lt;?php } else { ?&gt;<br />This post is password protected.<br />&lt;?php } ?&gt;<br /></blockquote>

<p>And now you're done. To password protect an entry, type in a password into the Entry Password field on the edit/new entry page now, readers will need to enter a password to be able to gain access to the entry. </p>

<div class="link-note">Thanks to Brad Choate for assistance with the dynamic publishing code</div>
]]>
</content>
</entry>
<entry>
<title>Quicktags for Comments</title>
<link rel="alternate" type="text/html" href="http://www.movalog.com/archives/code-snippets/quicktags-for-comments.php" />
<modified>2005-01-21T10:51:22Z</modified>
<issued>2005-01-21T10:33:43Z</issued>
<id>tag:www.movalog.com,2005://1.1176</id>
<created>2005-01-21T10:33:43Z</created>
<summary type="text/plain"><![CDATA[ Many people wanted to know how I implemented these guicktags into my comments form. So here's a quick tutorial for that. In your comments form find &lt;p&gt;&lt;label for="text"&gt;Comments:&lt;/label&gt; &lt;MTIfAllowCommentHTML&gt; (you may use HTML tags for style)&lt;/MTIfAllowCommentHTML&gt;&lt;br/&gt; &lt;textarea tabindex="4" id="text"...]]></summary>
<author>
<name>Arvind</name>

<email>arvind.2111@gmail.com</email>
</author>
<dc:subject>Code Snippets</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.movalog.com/">
<![CDATA[<div class="floatleft"><a href="http://www.movalog.com/quicktags_comments.png"><img alt="quicktags_comments.png" src="http://www.movalog.com/quicktags_comments-thumb.png" width="160" height="50" /></a></div>

<p>Many people wanted to know how I implemented <a href="http://www.movalog.com/archives/hacks/quicktags-part-ii.php">these guicktags</a> into my comments form. So here's a quick tutorial for that. In your comments form find </p>

<blockquote>&lt;p&gt;&lt;label for="text"&gt;Comments:&lt;/label&gt; &lt;MTIfAllowCommentHTML&gt;
(you may use HTML tags for style)&lt;/MTIfAllowCommentHTML&gt;&lt;br/&gt;
&lt;textarea tabindex="4" id="text" name="text" rows="10" cols="50"&gt;&lt;/textarea&gt;&lt;/p&gt;</blockquote>

<p>and replace it with</p>

<blockquote>&lt;div class="quicktags"&gt;&lt;p&gt;&lt;label for="text"&gt;Comments:&lt;/label&gt; &lt;MTIfAllowCommentHTML&gt;
&lt;script src="<span style="color: #FF0000">http://www.movalog.com/mt/js_quicktags.js</span>" type="text/javascript"&gt;&lt;/script&gt;&lt;script type="text/javascript"&gt;edToolbar();&lt;/script&gt;
&lt;/MTIfAllowCommentHTML&gt;&lt;br style="clear: both;" /&gt;
&lt;textarea tabindex="4" id="text" name="text" rows="10" cols="50"&gt;&lt;/textarea&gt;&lt;script type="text/javascript"&gt;var edCanvas = document.getElementById('text');&lt;/script&gt;&lt;/p&gt;&lt;/div&gt;</blockquote>

<p>and change the path in red to point to your js_quicktags.js file (which can be downloaded from the Quicktags tutorial linked above). After this is done, you'll want to make sure that the HTML generated by these buttons are allowed by your <a href="http://www.movalog.com/mt/docs/mtmanual_sanitize.html#sanitize:%20cleaning%20up%20incoming%20data">sanitize settings</a>.  </p>

<p>These quicktags can be applied to any textarea. To do so, first call the Quicktags toolbar with this</p>

<blockquote>&lt;script src="<span style="color: #FF0000">http://www.movalog.com/mt/js_quicktags.js</span>" type="text/javascript"&gt;&lt;/script&gt;&lt;script type="text/javascript"&gt;edToolbar();&lt;/script&gt;</blockquote>

<p>and then apply them to the textarea by putting this line of code straight after the textarea</p>

<blockquote>&lt;script type="text/javascript"&gt;var edCanvas = document.getElementById('<span style="color: #FF0000">text</span>');&lt;/script&gt;</blockquote>

<p>where "text" is the id of the textarea. </p>
]]>

</content>
</entry>
<entry>
<title>Rebuild Type</title>
<link rel="alternate" type="text/html" href="http://www.movalog.com/archives/hacks/rebuild-type.php" />
<modified>2005-01-28T06:03:09Z</modified>
<issued>2005-01-19T09:08:05Z</issued>
<id>tag:www.movalog.com,2005://1.1173</id>
<created>2005-01-19T09:08:05Z</created>
<summary type="text/plain"> When I stumbled across this hack I really liked what it did (this hack controls when index templates are rebuild for example you can specify index templates to only rebuild once a comment is posted) and so I ported...</summary>
<author>
<name>Arvind</name>

<email>arvind.2111@gmail.com</email>
</author>
<dc:subject>Hacks</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.movalog.com/">
<![CDATA[<div class="floatleft"><a href="http://www.movalog.com/rebuild_type.png"><img alt="rebuild_type.png" src="http://www.movalog.com/rebuild_type-thumb.png" width="108" height="75" /></a></div>

<p>When I stumbled across <a href="http://www.seanwillson.com/archives/2003/04/mt_rebuild_type_mod.php">this hack</a> I really liked what it did (this hack controls when index templates are rebuild for example you can specify index templates to only rebuild once a comment is posted) and so I ported it to MT 3.x</p>

<p>Unfortunately I have no idea how to create patch/diff files and I cannot package up the change modules due to the new licensing so here are instructions on how to do it yourself. </p>

<p>Its probably wise to say at this time that I don't take any responsibility for hacks gone wrong so do this at your risk and make sure you backup all your files.</p>
]]>
<![CDATA[<p>First of all, run this query on your Movable Type database:</p>

<blockquote>alter table mt_template add column template_rebuild_type text</blockquote>

Next, you'll need lib/MT.pm, find on approximately line 409 and 509 the following

<blockquote>$mt-&gt;rebuild_indexes( Blog =&gt; $blog ) or return;</blockquote>

and replace it with

<blockquote>$mt-&gt;rebuild_indexes( Blog =&gt; $blog, RebuildType =&gt; 'En' ) or return;</blockquote>

Next on line 887 find

<blockquote>        next if !$param{Force} && (<br />
                (defined $tmpl-&gt;rebuild_me && !$tmpl-&gt;rebuild_me)<br />
                                   && !$tmpl-&gt;build_dynamic);</blockquote>

and replace it with

<blockquote>                 my $tmplRebuildType = defined $tmpl-&gt;rebuild_type ? $tmpl-&gt;rebuild_type : 'EnCo';<br />
         my $rebuildType = $param{RebuildType};<br />

        next if ((! $param{Force}) && ($tmplRebuildType =~ /ne/gi));<br />

         next if ((! $param{Force}) &&<br />
                  ($rebuildType !~ /in/gi) &&<br />
                  ($tmplRebuildType !~ /$rebuildType|all/gi));</blockquote>

Save MT.pm and open up lib/MT/Template.pm and find on line 29

<blockquote>'rebuild_me',</blockquote>

and replace it with

<blockquote>'rebuild_me','rebuild_type',</blockquote>

Save Template.pm and next open lib/MT/App/CMS.pm and on line 773 find

<blockquote>$param{rebuild_me} = defined $obj-&gt;rebuild_me ?
                    $obj-&gt;rebuild_me : 1;</blockquote>

and add below it

<blockquote>                $param{rebuild_type} = defined $obj-&gt;rebuild_type ? $obj-&gt;rebuild_type : 'EnCo';<br />
                $param{'rebuild_type_'.$param{rebuild_type}} = 1;</blockquote>

Next find on line 985

<blockquote>$param{rebuild_me} = 1;</blockquote>

and add below it

<blockquote>                $param{rebuild_type} = 'EnCo';<br />
                $param{'rebuild_type_enco'} = 1;</blockquote>

On line 1659 find

<blockquote>$ref-&gt;[$i]{is_odd} = $i % 2 ? 0 : 1;</blockquote>

and add below it

<blockquote>                    $ref-&gt;[$i]{rebuild_type} = defined $ref-&gt;[$i]{rebuild_type} ? $ref-&gt;[$i]{rebuild_type} : 'EnCo';<br />
                    $ref-&gt;[$i]{'rebuild_type_'.$ref-&gt;[$i]{rebuild_type}} = 1;</blockquote>

On line 3473 find

<blockquote>$app-&gt;rebuild_indexes( BlogID =&gt; $blog_id ) or return;</blockquote>

and replace it with

<blockquote>$app-&gt;rebuild_indexes( BlogID =&gt; $blog_id, RebuildType =&gt; 'En' ) or return;</blockquote>

A few lines below that find

<blockquote>$app-&gt;rebuild_indexes( BlogID =&gt; $blog_id, Template =&gt; $tmpl_saved,</blockquote>

and replace it with

<blockquote>$app-&gt;rebuild_indexes( BlogID =&gt; $blog_id, Template =&gt; $tmpl_saved, RebuildType =&gt; 'En',
</blockquote>

<p>Save CMS.pm, open up lib/MT/App/Comments.pm and find on line 358</p>

<blockquote>$app-&gt;rebuild_indexes( Blog =&gt; $blog )</blockquote>

and replace it with

<blockquote>$app-&gt;rebuild_indexes( Blog =&gt; $blog, RebuildType =&gt; 'Co' )</blockquote>

Save Comments.pm and open up lib/MT/App/Trackback.pm and find on line 285

<blockquote>$app-&gt;rebuild_indexes( Blog =&gt; $blog )</blockquote>

and replace it with 

<blockquote>$app-&gt;rebuild_indexes( Blog =&gt; $blog, RebuildType =&gt; 'Tb' )</blockquote>

Next find on line 309

<blockquote>$fmgr-&gt;errstr));<br />
}
</blockquote>

<p>and add below it</p>

<blockquote>    $app-&gt;rebuild_entry( Entry =&gt; $entry )<br />
        or return $app-&gt;error($app-&gt;translate(<br />
            "Rebuild failed: [_1]", $app-&gt;errstr)) if ($entry);</blockquote>

<p>Save Trackback.pm. Now the only files left to edit are template files. First we'll tackle the Template listing, open up tmpl/cms/list_template.tmpl and find</p>

<blockquote>&lt;th width="30%"&gt;&lt;MT_TRANS phrase="Output File"&gt;&lt;/th&gt;</blockquote>

<p>and replace it with</p>

<blockquote>&lt;th width="20%"&gt;&lt;MT_TRANS phrase="Output File"&gt;&lt;/th&gt;</blockquote>

<p>Next find </p>

<blockquote>&lt;th width="20%"&gt;&lt;MT_TRANS phrase="Build w/Indexes"&gt;&lt;/th&gt;</blockquote>

<p>and replace it with</p>

<blockquote>&lt;th width="20%"&gt;&lt;MT_TRANS phrase="Rebuild Type"&gt;&lt;/th&gt;</blockquote>

<p>Next find</p>

<blockquote>&lt;TMPL_IF NAME=REBUILD_ME&gt;&lt;MT_TRANS phrase="Yes"&gt;&lt;TMPL_ELSE&gt;&lt;MT_TRANS phrase="No"&gt;&lt;/TMPL_IF&gt;</blockquote>

<p>and replace it with</p>

<blockquote>&lt;TMPL_IF NAME=REBUILD_TYPE_NE&gt;&lt;MT_TRANS phrase="Never"&gt;&lt;/TMPL_IF&gt;&lt;TMPL_IF NAME=REBUILD_TYPE_ALL&gt;&lt;MT_TRANS phrase="All"&gt;&lt;/TMPL_IF&gt;&lt;TMPL_IF NAME=REBUILD_TYPE_EN&gt;&lt;MT_TRANS phrase="Entry"&gt;&lt;/TMPL_IF&gt;&lt;TMPL_IF NAME=REBUILD_TYPE_CO&gt;&lt;MT_TRANS phrase="Comment"&gt;&lt;/TMPL_IF&gt;&lt;TMPL_IF NAME=REBUILD_TYPE_TB&gt;&lt;MT_TRANS phrase="Trackback"&gt;&lt;/TMPL_IF&gt;&lt;TMPL_IF NAME=REBUILD_TYPE_ENCO&gt;&lt;MT_TRANS phrase="Entry, Comment *"&gt;&lt;/TMPL_IF&gt;&lt;TMPL_IF NAME=REBUILD_TYPE_ENTB&gt;&lt;MT_TRANS phrase="Entry, Trackback"&gt;&lt;/TMPL_IF&gt;&lt;TMPL_IF NAME=REBUILD_TYPE_COTB&gt;&lt;MT_TRANS phrase="Comment, Trackback"&gt;&lt;/TMPL_IF&gt;</blockquote>

<p>Save list_template.tmpl and open up edit_template.tmpl, find</p>

<blockquote>&lt;div class="build-field"&gt;&lt;input type="checkbox" id="rebuild_me" name="rebuild_me" value="1" &lt;TMPL_IF NAME=REBUILD_ME&gt;checked="checked" &lt;/TMPL_IF&gt;/&gt;&lt;/div&gt;
&lt;p&gt;&lt;label for="rebuild_me"&gt;&lt;MT_TRANS phrase="Rebuild this template automatically when rebuilding index templates"&gt;&lt;/label&gt; &lt;a href="#" onclick="return openManual('templates', 'item_rebuild_this_template_automatically')" class="help"&gt;?&lt;/a&gt;&lt;/p&gt;</blockquote>

<p>and replace it with</p>

<blockquote>&lt;!-- &lt;div class="build-field"&gt;&lt;input type="checkbox" id="rebuild_me" name="rebuild_me" value="1" &lt;TMPL_IF NAME=REBUILD_ME&gt;checked="checked" &lt;/TMPL_IF&gt;/&gt;&lt;/div&gt; --&gt;<br /><br />

&lt;div class="build-field"&gt;&lt;select name="rebuild_type"&gt;
  &lt;option value="Ne" &lt;TMPL_IF NAME=REBUILD_TYPE_NE&gt;selected="selected"&lt;/TMPL_IF&gt;&gt;&lt;MT_TRANS phrase="Never"&gt;&lt;/option&gt;
  &lt;option value="En" &lt;TMPL_IF NAME=REBUILD_TYPE_EN&gt;selected="selected"&lt;/TMPL_IF&gt;&gt;&lt;MT_TRANS phrase="Entry"&gt;&lt;/option&gt;
  &lt;option value="Co" &lt;TMPL_IF NAME=REBUILD_TYPE_CO&gt;selected="selected"&lt;/TMPL_IF&gt;&gt;&lt;MT_TRANS phrase="Comment"&gt;&lt;/option&gt;
  &lt;option value="Tb" &lt;TMPL_IF NAME=REBUILD_TYPE_TB&gt;selected="selected"&lt;/TMPL_IF&gt;&gt;&lt;MT_TRANS phrase="Trackback"&gt;&lt;/option&gt;
  &lt;option value="EnCo" &lt;TMPL_IF NAME=REBUILD_TYPE_ENCO&gt;selected="selected"&lt;/TMPL_IF&gt;&gt;&lt;MT_TRANS phrase="Entry, Comment *"&gt;&lt;/option&gt;
  &lt;option value="EnTb" &lt;TMPL_IF NAME=REBUILD_TYPE_ENTB&gt;selected="selected"&lt;/TMPL_IF&gt;&gt;&lt;MT_TRANS phrase="Entry, Trackback"&gt;&lt;/option&gt;
  &lt;option value="CoTb" &lt;TMPL_IF NAME=REBUILD_TYPE_COTB&gt;selected="selected"&lt;/TMPL_IF&gt;&gt;&lt;MT_TRANS phrase="Comment, Trackback"&gt;&lt;/option&gt;
  &lt;option value="All" &lt;TMPL_IF NAME=REBUILD_TYPE_ALL&gt;selected="selected"&lt;/TMPL_IF&gt;&gt;&lt;MT_TRANS phrase="All"&gt;&lt;/option&gt;
  &lt;/select&gt;&lt;/div&gt;
  &lt;p&gt;&nbsp;&lt;label for="rebuild_type"&gt;Rebuild Type&lt;/label&gt; &lt;/p&gt;</blockquote>

<p>And finally, save edit_template.tmpl and upload all files to their places and you should have a new drop down list whilst editing the template. Change the value of this drop down to reflect when you want that index template rebuilt. Obviously dynamic templates aren't rebuilt. </p>

<p>In Sean's hack, he had to hack some of the MT-Blacklist files, in my testing I have not found such a need but I may be wrong. If something doesn't work correctly, post a comment and we can track it from there. </p>

<p>This hack will save a lot of time if used correctly and aggresively on your index templates. </p>
]]>
</content>
</entry>
<entry>
<title>Unapprove Comment</title>
<link rel="alternate" type="text/html" href="http://www.movalog.com/archives/hacks/unapprove-comment.php" />
<modified>2005-01-19T08:55:34Z</modified>
<issued>2005-01-16T11:49:24Z</issued>
<id>tag:www.movalog.com,2005://1.872</id>
<created>2005-01-16T11:49:24Z</created>
<summary type="text/plain">UPDATE Fixed a bug with moderation set on Typekey users. Bit to be edited is the code in edit_comment.tmpl The moderation queue is one of the most powerful features that MT 3 has, and some advocate an aggresive use of...</summary>
<author>
<name>Arvind</name>

<email>arvind.2111@gmail.com</email>
</author>
<dc:subject>Hacks</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.movalog.com/">
<![CDATA[<p><strong>UPDATE</strong> Fixed a bug with moderation set on Typekey users. Bit to be edited is the code in edit_comment.tmpl</p>

<div class="floatleft"><img alt="unapprove_comment.png" src="http://www.movalog.com/unapprove_comment.png" width="233" height="53" /></div>

<p>The moderation queue is one of the most powerful features that MT 3 has, and some advocate an aggresive use of it when paired with plugins. Currently, you are able to approve a comment but not unapprove a comment. This hack will add an unapprove button to the edit comment screen that will throw the comment back into moderation.</p>
]]>
<![CDATA[<p>Open lib/MT/App/CMS.pm and around line 32 find</p>

<blockquote>'approve_comment' => \&approve_comment,</blockquote>

<p>and add beneath it</p>

<blockquote>'unapprove_comment' => \&unapprove_comment,</blockquote>

<p>Next find </p>

<blockquote>sub list_commenters {</blockquote>

<p>and add above it</p>

<blockquote>sub unapprove_comment {<br />
    my $app = shift;<br />
    my $perms = $app-&gt;{perms}<br />
        or return $app-&gt;error($app-&gt;translate("No permissions"));<br />
    my $q = $app-&gt;{query};<br />
    my $comment_id = $q-&gt;param('id');<br />
    my $blog_id = $q-&gt;param('blog_id');<br />
    my $comment = MT::Comment-&gt;load($comment_id);<br />
    my $entry = MT::Entry-&gt;load($comment-&gt;entry_id) <br />
    || return $app-&gt;error("Comment on missing entry!");<br />
    if (!$perms-&gt;can_edit_all_posts()<br />
      && $entry-&gt;author_id != $app-&gt;{author}-&gt;id) {<br />
    return $app-&gt;error($app-&gt;translate(<br />
              "You don't have permission to approve this comment."));<br />
    }<br />
    <span style="color: #FF0000">$comment-&gt;visible(0);</span><br />
    $comment-&gt;save();<br />
    $app-&gt;rebuild_entry(Entry =&gt; $comment-&gt;entry_id, BuildDependencies =&gt; 1);<br />
    if ($q-&gt;param('_return') eq 'list_comments') {<br />
        return $app-&gt;redirect($app-&gt;uri . "?__mode=list_comments&blog_id=" . <br />
                              $blog_id . "&msg=The+comment+has+been+unapproved");<br />
    } else {<br />
        return $app-&gt;redirect($app-&gt;uri . "?__mode=view&_type=comment&blog_id=" . <br />
                              $blog_id . "&id=" . $comment_id .<br />
                              "&msg=The+comment+has+been+unapproved");<br />
    }<br />
}</blockquote>

<p>Basically this is just sub approve_comment but I changed visible to 0 (the red line). The last change needs to be made on tmpl/cms/edit_comment.tmpl. Find</p>

<blockquote>&lt;TMPL_IF NAME=INVISIBLE_UNREGISTERED&gt;
This comment was posted without registration. It is awaiting your approval.&lt;br /&gt;
&lt;input type="button" onClick="window.location='&lt;TMPL_VAR NAME="SCRIPT_URL"&gt;?__mode=approve_comment&blog_id=&lt;TMPL_VAR NAME="BLOG_ID"&gt;&id=&lt;TMPL_VAR NAME="ID"&gt;'" value="&lt;MT_TRANS phrase="Approve"&gt;"&gt;
&lt;/TMPL_IF&gt;</blockquote>

<p>and replace it with</p>

<blockquote>&lt;TMPL_IF NAME=VISIBLE&gt;&lt;input type="button" onClick="window.location='&lt;TMPL_VAR NAME="SCRIPT_URL"&gt;?__mode=unapprove_comment&blog_id=&lt;TMPL_VAR NAME="BLOG_ID"&gt;&id=&lt;TMPL_VAR NAME="ID"&gt;'" value="&lt;MT_TRANS phrase="Unapprove"&gt;"&gt;&lt;TMPL_ELSE&gt;This comment was posted without registration. It is awaiting your approval.&lt;br /&gt;
&lt;input type="button" onClick="window.location='&lt;TMPL_VAR NAME="SCRIPT_URL"&gt;?__mode=approve_comment&blog_id=&lt;TMPL_VAR NAME="BLOG_ID"&gt;&id=&lt;TMPL_VAR NAME="ID"&gt;'" value="&lt;MT_TRANS phrase="Approve"&gt;"&gt;&lt;/TMPL_IF&gt;</blockquote>

<p>Upload all files and when you edit a comment and that comment has been approved, you will have an Unapprove button along with Delete and Save. If you hit this button, the comment will be thrown back into the moderation queue and the necessary pages will be rebuilt.</p>
]]>
</content>
</entry>
<entry>
<title>Approve/Moderate All</title>
<link rel="alternate" type="text/html" href="http://www.movalog.com/archives/hacks/approvemoderate-all.php" />
<modified>2005-01-22T06:38:57Z</modified>
<issued>2005-01-13T16:44:41Z</issued>
<id>tag:www.movalog.com,2005://1.873</id>
<created>2005-01-13T16:44:41Z</created>
<summary type="text/plain"> In the early days of MT 3, when I had unreg&apos;d comments set to moderate, I really wanted to have an approval all button as I would read the comment in the email notification I received. Since then that...</summary>
<author>
<name>Arvind</name>

<email>arvind.2111@gmail.com</email>
</author>
<dc:subject>Hacks</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.movalog.com/">
<![CDATA[<div align="center"><a href="http://www.movalog.com/archives/approve_moderate_all.png"><img alt="approve_moderate_all.png" src="http://www.movalog.com/archives/approve_moderate_all-thumb.png" /></a></div>

<p>In the early days of MT 3, when I had unreg'd comments set to moderate, I really wanted to have an approval all button as I would read the comment in the email notification I received. Since then that feature request has not progressed so I decided to take matters into my own hands. As the screenshot shows, at the end of this hack you will end up with two buttons on the comments listing screen. This buttons will allow you to mass approve/moderate comments by checking the boxes of the corresponding entries.</p>
]]>
<![CDATA[<p>First of all open lib/MT/App/CMS.pm and find on approximately line 32 the following</p>

<blockquote>'approve_comment' =&amp;gt; \&approve_comment,</blockquote>

<p>and right after it</p>

<blockquote>        'approve_confirm' =&amp;gt; \&approve_confirm,
        'approve_all' =&gt; \&approve_all,</blockquote>

<p>Next find on approximately line 2115</p>

<blockquote>sub list_commenters {</blockquote>

<p>and add right above it the following</p>

<blockquote>    sub approve_confirm {<br />
        my $app = shift;<br />
        my %param = ( type =&amp;gt; scalar $app-&gt;{query}-&gt;param('_type') );<br />
        my @data;<br />
        for my $id ($app-&gt;{query}-&gt;param('id')) {<br />
            push @data, { id =&gt; $id };<br />
        }<br />
        $param{id_loop} = \@data;<br />
        $param{num} = scalar @data;<br />
        $param{'type_' . $param{type}} = 1;<br />
        $param{is_zero} = @data == 0;<br />
        $param{is_one} = @data == 1;<br />
        $param{is_many} = !$param{is_zero} &amp;& !$param{is_one};<br />
        $param{thisthese} = $param{is_one} ? 'this' : 'these';<br />
        $param{is_power_edit} = $app-&gt;{query}-&gt;param('is_power_edit') ? 1 : 0;<br />
    $param{_return} = $app-&gt;{query}-&gt;param('_return');<br />
    my $dowhat;<br />
    if($app-&gt;{query}-&gt;param('do') eq 'approve') {<br />
            $dowhat = "approve";<br />
        } elsif($app-&gt;{query}-&gt;param('do') eq 'unapprove') {<br />
            $dowhat = "unapprove";<br />
        } <br />
        $param{dowhat} = $dowhat;<br />
                    $app-&gt;build_page('approve_confirm.tmpl', \%param);<br />
    }<br /><br />

sub approve_all {<br />
    my $app = shift;<br />
    my $perms = $app-&gt;{perms}<br />
        or return $app-&gt;error($app-&gt;translate("No permissions"));<br />
    my $q = $app-&gt;{query};<br />
        my $blog_id = $q-&gt;param('blog_id');<br />
        my $type = $q-&gt;param('_type');<br />
         my $class = $app-&gt;_load_driver_for($type) or return;<br />
        for my $id ($q-&gt;param('id')) {<br />
        my $obj = $class-&gt;load($id);<br />
        next unless $obj;<br />
            my $entry = MT::Entry-&gt;load($obj-&gt;entry_id) <br />
    || return $app-&gt;error("Comment on missing entry!");<br />
    if (!$perms-&gt;can_edit_all_posts()<br />
      && $entry-&gt;author_id != $app-&gt;{author}-&gt;id) {<br />
    return $app-&gt;error($app-&gt;translate(<br />
              "You don't have permission to approve this comment."));<br />
    }<br />
        if($q-&gt;param('do') eq 'approve') {<br />
        $obj-&gt;visible(1);<br />
        } elsif($q-&gt;param('do') eq 'unapprove') {<br />
            $obj-&gt;visible(0);<br />
        }<br />
        $obj-&gt;save();<br />
            $app-&gt;rebuild_entry(Entry =&gt; $obj-&gt;entry_id, BuildDependencies =&gt; 1);<br />
  }<br />
my $url = $app-&gt;uri . '?__mode=list_comments&amp;blog_id='.$blog_id.'&amp;'.$q-&gt;param('do').'=1';<br />
$app-&gt;build_page('reload_opener.tmpl', { url =&gt; $url });<br />
}</blockquote>

<p>Finally download <a href="http://www.movalog.com/mt/tmpl/cms/list_comment.tmpl">list_comment.tmpl</a> and <a href="http://www.movalog.com/mt/tmpl/cms/approve_confirm.tmpl">approve_confirm.tmpl</a></p>

<p>Upload all files to their necessary locations and you should be good to go.</p>
]]>
</content>
</entry>
<entry>
<title>The IndiBlog Awards</title>
<link rel="alternate" type="text/html" href="http://www.movalog.com/archives/announcements/the-indiblog-awards.php" />
<modified>2005-01-09T15:22:54Z</modified>
<issued>2005-01-09T15:21:54Z</issued>
<id>tag:www.movalog.com,2005://1.870</id>
<created>2005-01-09T15:21:54Z</created>
<summary type="text/plain">Movalog has been nominated for the best science/technology IndiBlog. The IndiBlog Awards are publicly-chosen awards conferred upon bloggers from India or of Indian origin settled elsewhere. The winner of the best science/tech category wins a year&apos;s subscription to Typepad Plus....</summary>
<author>
<name>Arvind</name>

<email>arvind.2111@gmail.com</email>
</author>
<dc:subject>Announcements</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.movalog.com/">
<![CDATA[<p>Movalog has been <a href="http://indibloggies.blogspot.com/2005/01/and-nominees-are.html">nominated</a> for the best science/technology IndiBlog. The IndiBlog Awards are publicly-chosen awards conferred upon bloggers from India or of Indian origin settled elsewhere. The winner of the best science/tech category <a href="http://indibloggies.blogspot.com/2005/01/sponsors.html">wins</a> a year's subscription to Typepad Plus. </p>

<p><a href="http://indibloggies.blogspot.com/2005/01/indibloggies-2004-votepad.html">Go vote for Movalog</a> as the best science/tech Indian Blog.</p>
]]>

</content>
</entry>
<entry>
<title>Suggest Search</title>
<link rel="alternate" type="text/html" href="http://www.movalog.com/archives/plugins/suggest-search.php" />
<modified>2005-01-09T15:16:14Z</modified>
<issued>2005-01-09T11:08:55Z</issued>
<id>tag:www.movalog.com,2005://1.869</id>
<created>2005-01-09T11:08:55Z</created>
<summary type="text/plain">UPDATE files are bundled in an archive. I was very impressed with the WordPress Suggest plugin and wanted to port it over to MT. The porting was easy but the query was very slow and pulled some bad results from...</summary>
<author>
<name>Arvind</name>

<email>arvind.2111@gmail.com</email>
</author>
<dc:subject>Plugins</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.movalog.com/">
<![CDATA[<p><strong>UPDATE</strong> files are bundled in an archive.</p>

<div class="floatleft"><img alt="suggest_search.png" src="http://www.movalog.com/suggest_search.png" width="192" height="152" /></div>

<p>I was very impressed with the <a href="http://blog.linsin.de/index.php/archives/2004/12/23/wordpress-plugin-suggest/">WordPress Suggest</a> plugin and wanted to port it over to MT. The porting was easy but the query was very slow and pulled some bad results from the database. <a href="http://jayseae.cxliv.org/">Chad</a> helped me last night and we had almost cleaned it up until v0.2 was <a href="http://blog.linsin.de/index.php/archives/2005/01/08/new-version-of-suggest/">released</a> which seems to have fixed the problems I had. Try it using the search form on the sidebar.</p>

<p>This plugin is similar to <a href="http://blog.bitflux.ch/wiki/LiveSearch">LiveSearch</a> (and the <a href="http://blog.wishingline.com/archives/2004_12.php#000415">MT implementation</a>) however the difference is it lets you keep the mt-search.cgi functionality which I liked. Also this plugin works slightly differently to LiveSearch, I prefer this!</p>

<p>Implementing it with MT is very easy, you need to have PHP and be using mySQL as the database, I'm sure this probably works with other SQL based databases but I haven't had the opportunity to try it out. I've so far only managed to get this to work in Internet Explorer and Firefox. </p>
]]>
<![CDATA[<p>Download <a href="http://www.movalog.com/suggest.tar.gz">suggest.tar.gz</a> and extract the files. In ezsql.php enter your database values as instructed by the comments. These values are exactly the same as the database values entered in mt.cfg and mt-db-pass.cgi. Upload ezsql.php and ac.js to your web server and create a new index template with suggest_search.php (one for every blog you want this enabled)</p>

<p>Next, replace your search form with the following</p>

<blockquote>&lt;form method="get" action="&lt;$MTCGIPath$&gt;&lt;$MTSearchScript$&gt;" <span style="color: #FF0000">name="searchform"</span>&gt;
&lt;label for="search" accesskey="4"&gt;Search: &lt;/label&gt;&lt;br /&gt;&lt;input type="text" name="search" size="20" alt="Search Term"<span style="color: #FF0000">autocomplete="off"</span> /&gt;&lt;input type="submit" value="Search" <span style="color: #FF0000">name="subButton"</span>/&gt;
&lt;/form&gt;</blockquote>

<p>This is just the default search form with some few tweaks (highlighted in red), you can continue to have any of the other <a href="http://www.movalog.com/archives/code-snippets/tweaking-searches.php">options MT offers</a> but what I have pasted above must be present.</p>

<p>Finally right at the bottom of the page, just before the &lt;/body&gt; tag, add changing the bits highlighted in red to point to your files.</p>

<blockquote>&lt;script src="<span style="color: #FF0000">http://path.to/ac.js</span>"&gt;&lt;/script&gt;<br />
&lt;script&gt;InstallAC(document.searchform,document.searchform.search,document.searchform.subButton,"<span style="color: #FF0000">http://www.path.to.com/suggest_search.php</span>","en");&lt;/script&gt;</blockquote>

<p>Now when you start typing into the search, it should have drop down list similar to Google Suggest. If you want to tweak the colours in the drop down list, edit the colours found after the commented line</p>

<blockquote>// this function controls background color of marked row ( mozilla + IE )</blockquote>
]]>
</content>
</entry>
<entry>
<title>Sort Entry Listing</title>
<link rel="alternate" type="text/html" href="http://www.movalog.com/archives/hacks/sort-entry-listing.php" />
<modified>2005-01-19T06:24:32Z</modified>
<issued>2005-01-07T10:52:29Z</issued>
<id>tag:www.movalog.com,2005://1.867</id>
<created>2005-01-07T10:52:29Z</created>
<summary type="text/plain"> On the forums, someone recently commented on how the listings in MT could be improved with greater sorting flexibility. I thought that it was a very good idea and so after a bit of hacking managed to get the...</summary>
<author>
<name>Arvind</name>

<email>arvind.2111@gmail.com</email>
</author>
<dc:subject>Hacks</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.movalog.com/">
<![CDATA[<p><a href="http://www.movalog.com/sort_hack.png"><img alt="sort_hack.png" src="http://www.movalog.com/sort_hack-thumb.png" width="360" height="16" /></a></p>

<p>On the forums, someone recently <a href="http://www.movabletype.org/support/index.php?act=ST&amp;f=12&amp;t=48068&amp;hl=sort">commented</a> on how the listings in MT could be improved with greater sorting flexibility. I thought that it was a very good idea and so after a bit of hacking managed to get the entry listings to be sorted, it would be easy to adapt this for the comments and trackbacks listing.</p>

<p>This hack will add ascending and descending sorting capabilities to the title and date fields. The rest you can use the Filter option for.</p>
]]>
<![CDATA[<p>First, you'll need CMS.pm, around line 2411, find the following</p>

<blockquote>    my %arg = (<br />
            'sort' =&gt; $sort_type,<br />
            direction =&gt; $sort_order,<br />
            ($limit eq 'none' ? () : (limit =&gt; $limit + 1)),<br />
            ($offset ? (offset =&gt; $offset) : ()),<br />
    );</blockquote>

<p>and replace it with </p>

<blockquote>    my $sort_type = $q-&gt;param('sort_type') || 'created_on';<br />
    my $sort_order = $q-&gt;param('sort_order') || 'descend';<br />
    $param{sort_type} = $sort_type;<br />
    $param{sort_order} = $sort_order;<br />
    my %arg = (<br />
            'sort' =&gt; $sort_type,<br />
            direction =&gt; $sort_order,<br />
            ($limit eq 'none' ? () : (limit =&gt; $limit + 1)),<br />
            ($offset ? (offset =&gt; $offset) : ()),<br />
    );</blockquote>

<p>Next, grab a copy of <a href="http://www.movalog.com/mt/tmpl/cms/list_entry.tmpl">list_entry.tmpl</a> and finally add the following line to your styles.css</p>

<blockquote>.list table th a {<br />
    color:#FFF;<br />
    text-decoration:none;<br />
    }</blockquote>

<p>Upload all files to their respective locations and you should now be able to sort the title and date fields both ascending and descending. Post a comment if you experience any problems.</p>
]]>
</content>
</entry>
<entry>
<title>Staggered Category List</title>
<link rel="alternate" type="text/html" href="http://www.movalog.com/archives/hacks/staggered-category-list.php" />
<modified>2005-01-19T06:24:32Z</modified>
<issued>2005-01-06T04:51:47Z</issued>
<id>tag:www.movalog.com,2005://1.862</id>
<created>2005-01-06T04:51:47Z</created>
<summary type="text/plain">UPDATE: No more CSS, have MT auto indent. The &quot;Primary Category&quot; drop down menu just lists the categories sorted alphabetically and doesn&apos;t obey the category heirarchies you may have setup. This is especially annoying if you have several similarly named...</summary>
<author>
<name>Arvind</name>

<email>arvind.2111@gmail.com</email>
</author>
<dc:subject>Hacks</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.movalog.com/">
<![CDATA[<p><strong>UPDATE</strong>: No more CSS, have MT auto indent. </p>

<div class="floatleft"><a href="http://www.movalog.com/category_heirarchy.png"><img alt="category_heirarchy.png" src="http://www.movalog.com/category_heirarchy-thumb.png" width="105" height="70" /></a></div>

<p>The "Primary Category" drop down menu just lists the categories sorted alphabetically and doesn't obey the category heirarchies you may have setup. This is especially annoying if you have several similarly named sub categories under different parent categories. So here's a hack that will change the way that field works, the categories will now obey the category heirarchy as shown in the screenshot (click for a larger view) It's probably best to note that I'm not the most perl savvy and this code may <strong>not</strong> be the most efficient/quickest/best way to do it but it works for me.</p>
]]>
<![CDATA[<p>You'll need CMS.pm, open it up. Replace everything between</p>

<blockquote>            ## Load categories and process into loop for category pull-down.<br /><br />

            ## Now load user's preferences and customization for new/edit
            ## entry page.
</blockquote>

<p>(found approximately on line number 965) with this</p>

<blockquote>            ## Load categories and process into loop for category pull-down.<br />
            require MT::Category;<br />
            my $iter = MT::Category-&gt;load_iter({ blog_id =&gt; $blog_id });<br />
            my $cols = MT::Category-&gt;column_names;<br />
            my @data;<br />
            my $cat_id = $param{category_id};<br />
  my @cats = MT::Category-&gt;_flattened_category_hierarchy ($blog_id);<br />
  my $depth = 0;<br />
  my $i = 1;<br />
            while (my $obj = $iter-&gt;()) {<br />
  while (my $obj = shift @cats) {<br />
    my $row = { };<br />
    if (!ref ($obj)) {<br />
      if ($obj eq 'BEGIN_SUBCATS') {<br />
    $depth++;<br />
      } elsif ($obj eq 'END_SUBCATS') {<br />
    $depth--;<br />
      }<br />
#      $row-&gt;{$obj} = 1;<br />
#      push @data, $row;<br />
      next;<br />
    }<br />
    for my $col (@$cols) {<br />
      $row-&gt;{'category_' . $col} = $obj-&gt;$col();<br />
    }<br />
                            $row-&gt;{category_pixel_depth} = $depth;<br />
<span style="color: #FF0000">$row-&gt;{category_label} = ("&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;" x $depth) . $row-&gt;{category_label};</span><br />
                $row-&gt;{category_is_selected} = 1<br />
                    if $cat_id && $cat_id == $obj-&gt;id;<br />
                push @data, $row;<br />
            }<br />
            }<br />
            #@data = sort { $a-&gt;{category_label} cmp $b-&gt;{category_label} }<br />
            #        @data;<br />
            my $top = { category_id =&gt; '',<br />
                        category_label =&gt; $app-&gt;translate('Select') };<br />
            $top-&gt;{category_is_selected} = 1 unless $cat_id;<br />
            unshift @data, $top;<br />
            $param{category_loop} = \@data;<br /><br />

            ## Now load user's preferences and customization for new/edit<br />
            ## entry page.</blockquote>

<p>Save CMS.pm and upload it. If you followed the previous version of this tutorial that handled this with CSS, copy over the line in red above. Thanks to <a href="http://www.movalog.com/archives/hacks/staggered-category-list.php#c1210">Scott</a> for the solution.</p>
]]>
</content>
</entry>
<entry>
<title>Build Dynamically?</title>
<link rel="alternate" type="text/html" href="http://www.movalog.com/archives/hacks/build-dynamically.php" />
<modified>2005-01-22T06:32:04Z</modified>
<issued>2005-01-05T12:42:13Z</issued>
<id>tag:www.movalog.com,2005://1.860</id>
<created>2005-01-05T12:42:13Z</created>
<summary type="text/plain">Almost all my blogs have the &quot;Set Each Template&apos;s Build Options Separately&quot; option selected and the dynamic setting on my hundreds of templates is varied. I wanted to be able to see immediately which templates were and which templates were...</summary>
<author>
<name>Arvind</name>

<email>arvind.2111@gmail.com</email>
</author>
<dc:subject>Hacks</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.movalog.com/">
<![CDATA[<p>Almost all my blogs have the "Set Each Template's Build Options Separately" option selected and the dynamic setting on my hundreds of templates is varied. I wanted to be able to see immediately which templates were and which templates were not rebuilt dynamically from the templates listing view. A screenshot of how this look is above (click for a larger view) Obviously, this hack is only valid for MT versions equal to or greater than 3.1</p>
]]>
<![CDATA[<div align="center"><a href="http://www.movalog.com/build_dynamically.png"><img src="http://www.movalog.com/build_dynamically-thumb.png" width="318" height="61" border="0" /></a></div>

<p>You will need your list_template.tmpl file. Find </p>

<blockquote>&lt;th width="20%"&gt;&lt;MT_TRANS phrase="Build w/Indexes"&gt;&lt;/th&gt;</blockquote>

<p>and replace it with</p>

<blockquote>&lt;TMPL_IF NAME=DYNAMIC_CUSTOM&gt;&lt;th width="10%"&gt;&lt;MT_TRANS phrase="w/Indexes"&gt;&lt;/th&gt;
&lt;th width="10%"&gt;&lt;MT_TRANS phrase="Dynamic"&gt;&lt;/th&gt;
&lt;TMPL_ELSE&gt;
&lt;th width="20%"&gt;&lt;MT_TRANS phrase="Build w/Indexes"&gt;&lt;/th&gt;&lt;/TMPL_IF&gt;</blockquote>

<p>Next, find</p>

<blockquote>&lt;td&gt;&lt;TMPL_IF NAME=REBUILD_ME&gt;&lt;MT_TRANS phrase="Yes"&gt;&lt;TMPL_ELSE&gt;&lt;MT_TRANS phrase="No"&gt;&lt;/TMPL_IF&gt;&lt;/td&gt;</blockquote>

<p>and add underneath it</p>

<blockquote>&lt;TMPL_IF NAME=DYNAMIC_CUSTOM&gt;&lt;td&gt;&lt;TMPL_IF NAME=BUILD_DYNAMIC&gt;&lt;MT_TRANS phrase="Yes"&gt;&lt;TMPL_ELSE&gt;&lt;MT_TRANS phrase="No"&gt;&lt;/TMPL_IF&gt;&lt;/td&gt;&lt;/TMPL_IF&gt;</blockquote>

<p>That will enable this view for the index templates. For the archive templates, find </p>

<blockquote>&lt;th width="90%"&gt;&lt;MT_TRANS phrase="Template Name"&gt;&lt;/th&gt;</blockquote>

<p>and replace it with </p>

<blockquote>&lt;TMPL_IF NAME=DYNAMIC_CUSTOM&gt;&lt;th width="80%"&gt;&lt;MT_TRANS phrase="Template Name"&gt;&lt;/th&gt;&lt;th width="10%"&gt;&lt;MT_TRANS phrase="Dynamic"&gt;&lt;/th&gt;&lt;TMPL_ELSE&gt;&lt;th width="90%"&gt;&lt;MT_TRANS phrase="Template Name"&gt;&lt;/th&gt;&lt;/TMPL_IF&gt;</blockquote>

<p>Next around six lines down, after a line that looks something similar to </p>

<blockquote>&lt;td&gt;&lt;a href="&lt;TMPL_VAR NAME=SCRIPT_URL&gt;?__mode=view&amp;_type=template&amp;id=&lt;TMPL_VAR NAME=ID&gt;&amp;blog_id=&lt;TMPL_VAR NAME=BLOG_ID&gt;"&gt;&lt;MT_TRANS phrase="&lt;TMPL_VAR NAME=NAME&gt;"&gt;&lt;/a&gt;&lt;/td&gt;</blockquote>

<p>add</p>

<blockquote>&lt;TMPL_IF NAME=DYNAMIC_CUSTOM&gt;&lt;td&gt;&lt;TMPL_IF NAME=BUILD_DYNAMIC&gt;&lt;MT_TRANS phrase="Yes"&gt;&lt;TMPL_ELSE&gt;&lt;MT_TRANS phrase="No"&gt;&lt;/TMPL_IF&gt;&lt;/td&gt;&lt;/TMPL_IF&gt;</blockquote>

<p>And you're all set. If (and only if) you select the option "Set Each Template's Build Options Separately" a new column will pop up on the Templates listing page that will show you whether or not that template is built dynamically. </p>

<p>I'm also tinkering around with the ability to have a checkbox that is ticked or not instead of Yes and No. This way it becomes a piece of cake to mass edit templates, but the page may start to get crowded...</p>
]]>
</content>
</entry>
<entry>
<title>Configure Active Plugins</title>
<link rel="alternate" type="text/html" href="http://www.movalog.com/archives/hacks/configure-active-plugins.php" />
<modified>2005-01-19T06:24:33Z</modified>
<issued>2005-01-04T12:44:19Z</issued>
<id>tag:www.movalog.com,2005://1.858</id>
<created>2005-01-04T12:44:19Z</created>
<summary type="text/plain"> I find the Configure Active Plugins list on the MT front page very useful, however this list has been getting longer and longer and I install more and more plugins that register on there. Eventually this bugged me (big...</summary>
<author>
<name>Arvind</name>

<email>arvind.2111@gmail.com</email>
</author>
<dc:subject>Hacks</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.movalog.com/">
<![CDATA[<div class="floatleft"><a href="http://www.movalog.com/config_plugin_menu.php" onclick="window.open('http://www.movalog.com/config_plugin_menu.php','popup','width=271,height=676,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img alt="config_plugins.png" src="http://www.movalog.com/config_plugins.png" width="244" height="63" /></a></div>

<p>I find the Configure Active Plugins list on the MT front page very useful, however this list has been getting longer and longer and I install more and more plugins that register on there. Eventually this bugged me (big surprise eh?) and I decided to move that to its own page. Click the thumbnail to the side for a larger image.</p>
]]>
<![CDATA[<p>First open up lib/MT/App/CMS.pm and find around line 40</p>

<blockquote>            'list_blogs' =&gt; \&list_blogs,</blockquote>

<p>and add right underneath it</p>

<blockquote>            'list_plugins' =&gt; \&list_plugins,</blockquote>

<p>Next around line 342 (at the end of sub list_blog) fine</p>

<blockquote>    $param{no_breadcrumbs} = 1;<br />
$app-&gt;build_page('list_blog.tmpl', \%param);<br />
}</blockquote>

<p>and add after it</p>

<blockquote>sub list_plugins {<br />
    my $app = shift;<br />
    my $q = $app-&gt;{query};<br />
    require MT::Blog;<br />
    require MT::Permission;<br />
    require MT::Entry;<br />
    require MT::Comment;<br />
    my $author = $app-&gt;{author};<br />
    my @perms = MT::Permission-&gt;load({ author_id =&gt; $author-&gt;id });<br />
    my %perms = map { $_-&gt;blog_id =&gt; $_ } @perms;<br />
    my @blogs = MT::Blog-&gt;load;<br />
    my $data = [];<br />
    my %param;<br />
    my $i = 1;<br />
        $param{blog_loop} = $data;<br />
    $param{can_create_blog} = $author-&gt;can_create_blog;<br />
    $param{can_view_log} = $author-&gt;can_view_log;<br />
    $param{saved_deleted} = $q-&gt;param('saved_deleted');
    if ($author-&gt;can_create_blog()) {<br />
    $param{blog_count} = MT::Blog-&gt;count();<br />
    $param{blog_count_plural} = $param{blog_count} != 1;<br />
    $param{author_count} = MT::Author-&gt;count({type =&gt; AUTHOR});<br />
    $param{author_count_plural} = $param{author_count} != 1;<br />
    $param{can_view_blog_count} = 1;<br />
    }<br />
   $param{news_html} = $app-&gt;get_newsbox_content();<br />
    $data = [];<br />
    for my $plugin (@MT::Plugins) {<br />
    my $plugin_name = remove_html($plugin-&gt;name());<br />
    $plugin-&gt;{description} = remove_html($plugin-&gt;{description});<br />
        (my $cgi_path = $app-&gt;{cfg}-&gt;CGIPath) =~ s|/$||;<br />
    my $plugin_page = ($cgi_path . '/' <br />
               . $plugin-&gt;envelope . '/' . $plugin-&gt;config_link())<br />
        if $plugin-&gt;{config_link};<br />
    my $row = { plugin_name =&gt; $plugin_name,<br />
            plugin_page =&gt; $plugin_page,<br />
            plugin_desc =&gt; $plugin-&gt;description(),<br />
        plugin_doc_link =&gt; $plugin-&gt;doc_link() };<br />
    push @$data, $row;<br />
    }<br />
    $param{plugin_loop} = $data;<br />
        $param{no_breadcrumbs} = 1;<br />
        $app-&gt;build_page('list_plugins.tmpl', \%param);<br />
 }</blockquote>

<p>Next download <a href="http://www.movalog.com/list_blog.txt">list_blog.tmpl</a> and <a href="http://www.movalog.com/list_plugins.txt">list_plugins.tmpl</a> or if you have implemented the skinning MT hacking, download these versions of <a href="http://www.movalog.com/list_blog_skin.txt">list_blog.tmpl</a> and <a href="http://www.movalog.com/list_plugins_skin.txt">list_plugins.tmpl</a>. Finally download <a href="http://www.movalog.com/mt/images/plug.gif">plug.gif</a></p>

<p>Upload all the files to their appropriate places and you should be all set. Now when you login to MT, you'll only get a list of your blogs and the plugins listing will be on a separate page.</p>
]]>
</content>
</entry>
<entry>
<title>Moblogging with MT</title>
<link rel="alternate" type="text/html" href="http://www.movalog.com/archives/plugins/moblogging-with-mt.php" />
<modified>2004-12-25T09:22:15Z</modified>
<issued>2004-12-25T10:44:12Z</issued>
<id>tag:www.movalog.com,2004://1.30</id>
<created>2004-12-25T10:44:12Z</created>
<summary type="text/plain">UPDATE Typepad has moblogging built in but what can you do with MT. There are certain scripts you could setup on your servers. Pop2Blog is one such script, and another is pop3-to-blog. However with these scripts you would need to...</summary>
<author>
<name>Arvind</name>

<email>arvind.2111@gmail.com</email>
</author>
<dc:subject>Plugins</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.movalog.com/">
<![CDATA[<p><strong>UPDATE</strong></p>

<p><a href="http://www.typepad.com">Typepad</a> has moblogging built in but what can you do with MT. There are certain scripts you could setup on your servers. <a href="http://mt-plugins.org/archives/entry/pop2blog.php">Pop2Blog</a> is one such script, and another is <a href="http://www.ian-barton.com/ianblog/archives/2003/04/16/posting-to-your-blog-from-a-pop3-account/">pop3-to-blog</a>. However with these scripts you would need to setup cron jobs to scan your emails and then post to MT.</p>

<p>That's when I found <a title="Mfop2" href="http://new.bastish.net/cgi-bin/mfop2/index.cgi">Mfop2</a></p>

<blockquote>Mfop2 allows you to moblog without setting up any special scripts on your own mail server. To use Mfop2, all you have to do is register some of your blog details and you will be able to post to your blog from your mobile by emailing your blog entry with images attached to mfop2@bastish.net.</blockquote>

<p>Another interesting option is <a href="http://mobilemt.sourceforge.net/src/">mobileMT</a></p>

<blockquote>mobileMT is a WAP interface for the MovableType publishing system written in PHP.</blockquote>
]]>

</content>
</entry>
<entry>
<title>Build All Templates Dynamically</title>
<link rel="alternate" type="text/html" href="http://www.movalog.com/archives/hacks/build-all-templates-dynamically.php" />
<modified>2005-01-19T06:24:34Z</modified>
<issued>2004-12-22T12:27:49Z</issued>
<id>tag:www.movalog.com,2004://1.835</id>
<created>2004-12-22T12:27:49Z</created>
<summary type="text/plain"> I really like the &quot;Build All Templates Statically&quot; option on the Templates page, however I really wanted a Build All Templates Dynamically option. I posted a feature request on the subject but I don&apos;t think it was taken any...</summary>
<author>
<name>Arvind</name>

<email>arvind.2111@gmail.com</email>
</author>
<dc:subject>Hacks</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.movalog.com/">
<![CDATA[<div class="floatleft"><a href="http://www.movalog.com/build_dynamically_all.png"><img alt="build_dynamically_all.png" src="http://www.movalog.com/build_dynamically_all-thumb.png" width="139" height="70" /></a></div>

<p>I really like the "Build All Templates Statically" option on the Templates page, however I really wanted a Build All Templates Dynamically option. I posted a feature request on the subject but I don't think it was taken any further, so I took the matter into my own hands, see the screenshot (click for larger image). </p>
]]>
<![CDATA[<p>Open up <em>MT/App/CMS.pm</em> and search for the following block of text, line #4842. </p>

<blockquote>    } elsif ($dcty eq 'archives') {<br />
        require MT::Template;<br />
        my @templates = MT::Template-&gt;load({ blog_id =&gt; $blog-&gt;id });<br />
        for my $tmpl (@templates) {<br />
            $tmpl-&gt;build_dynamic($tmpl-&gt;type ne 'index');<br />
            $tmpl-&gt;save();<br />
        }<br />
    } elsif ($dcty eq 'custom') {</blockquote>

<p>Add replace it with the following</p>

<blockquote>    } elsif ($dcty eq 'archives') {<br />
        require MT::Template;<br />
        my @templates = MT::Template-&gt;load({ blog_id =&gt; $blog-&gt;id });<br />
        for my $tmpl (@templates) {<br />
            $tmpl-&gt;build_dynamic($tmpl-&gt;type ne 'index');<br />
            $tmpl-&gt;save();<br />
        }<br />
    } elsif ($dcty eq 'all') {<br />
        require MT::Template;<br />
        my @templates = MT::Template-&gt;load({ blog_id =&gt; $blog-&gt;id });<br />
        for my $tmpl (@templates) {<br />
            $tmpl-&gt;build_dynamic($tmpl-&gt;name ne '<span style="color: #FF0000">Dynamic Site Bootstrapper</span>');<br />
            $tmpl-&gt;save();<br />
        }<br />
    } elsif ($dcty eq 'custom') {</blockquote>

<p>If your mtview.php template is called something else, replace the red text above.</p>

<p>Next open up <em>tmpl/list_template.tmpl</em> and search for the following code (line 59)</p>

<blockquote>&lt;input type="radio" id="dynamic_none" name="dynamicity" value="none"&lt;TMPL_IF NAME=DYNAMIC_NONE&gt; checked="on"&lt;/TMPL_IF&gt;/&gt; &lt;label for="dynamic_none"&gt;&lt;MT_TRANS phrase="Build All Templates Statically"&gt;&lt;/label&gt;&lt;br /&gt;</blockquote>

<p>Add right after it the following </p>

<blockquote>&lt;input type="radio" id="dynamic_all" name="dynamicity" value="all"&lt;TMPL_IF NAME=DYNAMIC_ALL&gt; checked="on"&lt;/TMPL_IF&gt;/&gt; &lt;label for="dynamic_all"&gt;&lt;MT_TRANS phrase="Build All Templates Dynamically"&gt;&lt;/label&gt;&lt;br /&gt;</blockquote>

<p><strike>There is a problem with this code. Currently I haven't yet figured out how to have the Build All Templates Dynamically option having the radio button selected if that is the option you had chosen before.</strike></p>

<p>Next to ensure that the option remains checked after being selected, find </p>

<blockquote>            $param{dynamic_none} = $blog-&gt;custom_dynamic_templates eq 'none';</blockquote>

<p>around line 1590 and add right after it</p>

<blockquote>            $param{dynamic_all} = $blog-&gt;custom_dynamic_templates eq 'all';</blockquote>

<div class="link-note">Thanks to <a href="http://www.movalog.com/archives/hacks/build-all-templates-dynamically.php#c1185">Marshall</a> for this solution</div>

<p>Once this Build All Templates Dynamically option has been selected, you will need to perform a full site rebuild. </p>
]]>
</content>
</entry>

</feed>