<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
   <title>Posts by Arvind Satyanarayan on Learning Movable Type</title>
   <link rel="alternate" type="text/html" href="http://www.learningmovabletype.com/" />
   <link rel="self" type="application/atom+xml" href="http://www.learningmovabletype.com/contributors/arvind/" />
   <id>tag:www.learningmovabletype.com,2008-02-25:/5</id>
   <updated>2007-06-22T05:36:23Z</updated>
   <subtitle>Tutorials and helpful tips for the Movable Type web publishing system</subtitle>
   <generator uri="http://www.movabletype.org/">Movable Type Pro 4.361</generator>

<entry>
   <title>Adding a Calendar to Your MT Blog</title>
   <link rel="alternate" type="text/html" href="http://www.learningmovabletype.com/a/001511adding_a_calendar/" />
   <id>tag:www.learningmovabletype.com,2005://10.1511</id>
   
   <published>2005-11-11T04:40:49Z</published>
   <updated>2007-06-22T05:36:23Z</updated>
   
   <summary>This tutorial is written by LMT author Arvind Satyanarayan of Movalog. Tutorial cross posted on Movalog and LMT. With the release of Movable Type version 3.2, Six Apart opted to not include the calendar feature that had been included by default in earlier versions. The reason for this is that...</summary>
   <author>
      <name>Arvind Satyanarayan</name>
      <uri>http://www.movalog.com/</uri>
   </author>
   
      <category term="Templates" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="calendar" label="Calendar" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://www.learningmovabletype.com/">
      <![CDATA[<p><em>This tutorial is written by LMT author Arvind Satyanarayan of <a href="http://www.movalog.com">Movalog</a>.
Tutorial cross posted on <a href="http://www.movalog.com/archives/code-snippets/movable-type-calendars">Movalog</a> and LMT.</em></p>

<p><img alt="mtbadge-small.gif" src="http://www.learningmovabletype.com/images/mtbadge-small.gif" width="50" height="50" class="floatimgleft" />With the release of Movable Type version 3.2, Six Apart opted to not include the calendar feature that had been included by default in earlier versions.  The reason for this is that calendars, with the days linking to blog archives, are resource intensive; they can significantly lengthen rebuild times.  Six Apart has posted <a href="http://www.sixapart.com/movabletype/docs/3.2/03_templates_and_layout/calendar_layout.html">the code that was used in previous versions</a> of MT. However, many users have found that simply copying and pasting the code as given doesn't yield a properly formatted calendar. </p>

<p>The following code will create a calendar that will be correctly formatted and styled according your stylesheet. Simply copy the code and put it in the sidebar section of your index template.  A good location would be just above <code>&lt;div class="module-search module"&gt;</code>.</p>
]]>
      <![CDATA[<pre><code>&lt;div class="module-calendar module"&gt;
&lt;h2 class="module-header"&gt;&lt;$MTDate format="%B %Y"$&gt;&lt;/h2&gt;
&lt;div class="module-content"&gt;
&lt;table summary="Monthly calendar with links to each day's posts"&gt;

&lt;tr&gt;
&lt;th abbr="Sunday"&gt;Sun&lt;/th&gt;
&lt;th abbr="Monday"&gt;Mon&lt;/th&gt;
&lt;th abbr="Tuesday"&gt;Tue&lt;/th&gt;
&lt;th abbr="Wednesday"&gt;Wed&lt;/th&gt;
&lt;th abbr="Thursday"&gt;Thu&lt;/th&gt;
&lt;th abbr="Friday"&gt;Fri&lt;/th&gt;
&lt;th abbr="Saturday"&gt;Sat&lt;/th&gt;
&lt;/tr&gt;
&lt;MTCalendar&gt;
&lt;MTCalendarWeekHeader&gt;&lt;tr&gt;&lt;/MTCalendarWeekHeader&gt;
&lt;td&gt;
&lt;MTCalendarIfEntries&gt;
&lt;MTEntries lastn="1"&gt;
&lt;a href="&lt;$MTEntryPermalink$&gt;"&gt;&lt;$MTCalendarDay$&gt;&lt;/a&gt;
&lt;/MTEntries&gt;
&lt;/MTCalendarIfEntries&gt;
&lt;MTCalendarIfNoEntries&gt;
&lt;$MTCalendarDay$&gt;
&lt;/MTCalendarIfNoEntries&gt;
&lt;MTCalendarIfBlank&gt;&amp;nbsp;&lt;/MTCalendarIfBlank&gt;&lt;/td&gt;
&lt;MTCalendarWeekFooter&gt;&lt;/tr&gt;&lt;/MTCalendarWeekFooter&gt;
&lt;/MTCalendar&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
</code></pre>
]]>
   </content>
</entry>

<entry>
   <title>The New Themes - Making Sense of It All</title>
   <link rel="alternate" type="text/html" href="http://www.learningmovabletype.com/a/001396the_new_themes/" />
   <id>tag:www.elise.com,2005:/mt//10.1396</id>
   
   <published>2005-09-04T07:13:43Z</published>
   <updated>2007-06-22T05:36:23Z</updated>
   
   <summary> This tutorial is written by LMT author Arvind Satyanarayan of Movalog. Tutorial cross posted on Movalog and LMT. With Movable Type 3.2, Six Apart launched a new markup and stylesheet structure that has also unified their three platforms. These new templates and stylesheets (from now on referred to as...</summary>
   <author>
      <name>Arvind Satyanarayan</name>
      <uri>http://www.movalog.com/</uri>
   </author>
   
      <category term="Templates" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="3column" label="3-Column" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="layout" label="Layout" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="mt32" label="MT3.2" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="sidebar" label="Sidebar" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="styles" label="Styles" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="templates" label="Templates" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://www.learningmovabletype.com/">
      <![CDATA[<p><img alt="mtbadge-small.gif" src="http://www.learningmovabletype.com/images/mtbadge-small.gif" width="50" height="50" class="floatimgleft" /><br />
<em>This tutorial is written by LMT author Arvind Satyanarayan of <a href="http://www.movalog.com">Movalog</a>.<br />
Tutorial cross posted on <a href="http://www.movalog.com/archives/weblog-design/understanding-the-new-themes">Movalog</a> and LMT.</em></p>

<p>With Movable Type 3.2, Six Apart launched <a target="_self" href="http://www.sixapart.com/pronet/weblog/2005/08/smart_new_templ.html">a new markup and stylesheet structure</a> that has also unified their three platforms. These new templates and stylesheets (from now on referred to as themes) have been called tag soup due to the sheer number of &lt;div&gt;s and indents. </p> <h3><strong>What a mess - why did they do it?</strong></h3> <p>The new themes can be quite intimidating the first time you come across them, however Six Apart created these new themes for several reasons:</p> <ul>   <li>First of all, Typepad, LiveJournal and Movable Type now share <strong>exactly the same</strong> markup. This means that a theme will work on any of these three platforms and designers can design to around 10 million bloggers worldwide!</li>   <li>The new templates are powerful. Giving each element on a page an ID means that it will be easy to start implement cool javascript and ajax effects. It also means that people can start creating scripts for applications, e.g. greasemonkey, that will make browsing a weblog a lot more easy and fun. <br />   </li>   <li>This is just the tip of the iceburg. Six Apart has a few announcements coming soon that will prove to be useful to all webloggers on Typepad, Movable Type and LiveJournal.</li> </ul>The quickest way to get started with these new styles is to install the <a target="_self" href="http://www.sixapart.com/movabletype/news/2005/08/stylecatcher_pu.html">StyleCatcher</a> plugin so you don't even need to worry about the new themes. Just install the plugin, chose a theme that you like and the plugin automatically applies it for you (creating backups as it goes along). However if you're brave, read on to understand these templates, what they do and how to make effective use of them. <br />]]>
      <![CDATA[<p><br /><h3><strong>Alpha, Beta - sounds Greek</strong></h3> <p>If you cast your mind back to the 3.1x templates, MT had columns named center, right, left etc. - nice and easy to understand. So why on earth did Six Apart change that to alpha, beta and other letters from the Greek alphabet. The reason is quite simply that the names center, right, left and content might not always apply. For example, <a href="http://www.learningmovabletype.com/archives/000478simple_changes_to_the_default_mt3_styles.php" target="_self">in this MT3.1 tutorial</a> Elise described how to change the positioning of the sidebar from right to left. Doing so would create quite a mess in the stylesheet because you'd have an element called right but it would be on the left! Also on more complex installations, the column containing the entries might not always be on the center (for example <a href="http://www.engadget.com/" target="_self">Engadget</a>). </p><p>As a result, Six Apart created fairly ambiguous names to, ironically, lessen the confusion. So we now have columns called #alpha, #beta, #gamma and #delta. The &quot;beauty&quot; of this new layout is that the columns always follow in that order no matter how many columns you have. From the left, the first column will always be #alpha, the second #beta, the third #gamma and the fourth #delta. The images below might help you understand better:</p><a href="http://www.learningmovabletype.com/images/layout-two-column-left.gif"><img alt="layout-two-column-left.gif" src="http://www.learningmovabletype.com/images/layout-two-column-left-thumb.gif" width="163" height="110" /></a> <a href="http://www.learningmovabletype.com/images/layout-two-column-right.gif"><img alt="layout-two-column-right.gif" src="http://www.learningmovabletype.com/images/layout-two-column-right-thumb.gif" width="159" height="110" /></a> <a href="http://www.learningmovabletype.com/images/layout-three-column.gif"><img alt="layout-three-column.gif" src="http://www.learningmovabletype.com/images/layout-three-column-thumb.gif" width="162" height="110" /></a></p>

<p>  <h3><strong>base-weblog.css - what it is, why it matters<br /> </strong></h3><p>If you have used the <a href="http://www.sixapart.com/movabletype/news/2005/08/stylecatcher_pu.html" target="_self">StyleCatcher plugin</a> you will have already seen the base-weblog.css file. This aptly named stylesheet is basically the base for all of Six Apart's present and future stylesheets. All it basically does is define the positioning of the various elements and some very basic styling for those elements. If you have freshly installed Movable Type 3.2 and see only one stylesheet index template then the base-weblog.css part is everything from the top until the /* theme */ declaration. As this section is the base stylesheet for all templates, I would caution you against changing anything in this section, doing so could cause some display errors with different themes across different browsers. All changes to the stylesheet must be done below the /* theme */ declaration or within the theme file. This way you will avoid any conflicts when changing between themes. </p> <h3><strong>Switching layouts - 1,2,3</strong></h3> <p>One of the most powerful aspects of the new stylesheets is the fact that they come with built-in support for one, two and three column layouts; to switch layouts all you need to make some markup changes. I will guide you through switching the layouts and provide general advise as to how to make this an easier process. <strong>Note: </strong>I've discovered this whilst coding the next version of the <a target="_self" href="http://www.styles.movalog.com/generator/">Style Generator</a>, as a result, using stylesheets generated with the current Style Generator, the following will not work. </p> <p>If you open your Main Index Template and find the &lt;body&gt; tag, you will see that it has a class attribute, by default layout-two-column-right. This class defines the basic layout of the page and where the sidebars go. You can change this class to any of the following:</p> <ul>   <li>layout-one-column - for a one column layout</li>   <li>layout-two-column-left - a two column layout with the sidebar on the left</li>   <li>layout-two-column-right - a two column layout with the sidebar on the right</li>   <li>layout-three-column - a three column layout.</li> </ul> <p>Simply changing the class could kick your theme out of whack, the reason being, the divs must follow the order I talked about above, i.e. #alpha, #beta, #gamma and #delta. As a result:</p> <ul>   <li>One Column Layout - you only need one column, #alpha, which contains your content. By default the theme will apply the necessary styling.</li><li>Two Column with sidebar on the left - here you will have two columns, the sidebar will be #alpha and the main content column will be #beta. To move from the default templates to this layout, copy your sidebar (i.e. everything between&lt;div id=&quot;beta-inner&quot;&gt;&lt;/div&gt;) into the content column (i.e. paste it just below &lt;div id=&quot;alpha-inner&quot;&gt;&lt;/div&gt;). Do the same with your content so that your sidebar is now #alpha and your content column #beta.</li>   <li>Three Column - for this layout, you will first need a sidebar called #alpha, next comes your content column #beta and finally the second sidebar called #gamma. The easiest way to implement this layout from the defaults, is to copy the #beta div(i.e. everything between &lt;div id=&quot;beta&quot;&gt;&lt;/div&gt;) and paste it just below &lt;div id=&quot;pagebody-inner&quot; class=&quot;pkg&quot;&gt;. Finally you will need to rename the three divs so that they are in order, #alpha, #beta, #gamma.</li>  </ul><p>During my testing, I found that the easiest way to implement the new layouts is to split the layouts by the columns into separate index templates. Therefore, I would advise you to copy each column for example #alpha into a separate index template and then PHP include that in. As a result, you can grab these templates (based off the default templates):</p> <ul>   <li>One Column Layout - <a target="_self" href="http://styles.movalog.com/templates/layout-one-column-alpha.txt">#alpha</a></li>   <li>Two Column Layout (Left) - <a target="_self" href="http://styles.movalog.com/templates/layout-two-column-left-alpha.txt">#alpha</a>, <a target="_self" href="http://styles.movalog.com/templates/layout-two-column-left-beta.txt">#beta</a></li>   <li>Two Column Layout (Right) - <a target="_self" href="http://styles.movalog.com/templates/layout-two-column-right-alpha.txt">#alpha</a>, <a target="_self" href="http://styles.movalog.com/templates/layout-two-column-right-beta.txt">#beta</a><br />   </li>   <li>Three Column Layout - <a target="_self" href="http://styles.movalog.com/templates/layout-three-column-alpha.txt">#alpha</a>, <a target="_self" href="http://styles.movalog.com/templates/layout-three-column-beta.txt">#beta</a>, <a target="_self" href="http://styles.movalog.com/templates/layout-three-column-gamma.txt">#gamma</a><br />   </li> </ul> So depending on the layout you want, grab the appropriate files, build a new index template for each and include them into your other templates in the correct order #alpha, #beta, #gamma and make sure you have the correct body class specified.<br /> <p> </p></p>]]>
   </content>
</entry>

<entry>
   <title>Troubleshooting Smarty Errors</title>
   <link rel="alternate" type="text/html" href="http://www.learningmovabletype.com/a/001111smarty_errors/" />
   <id>tag:www.elise.com,2005:/mt//10.1111</id>
   
   <published>2005-05-28T07:16:33Z</published>
   <updated>2007-06-22T05:36:23Z</updated>
   
   <summary>This tutorial is written by LMT contributor Arvind Satyanarayan of Movalog. Tutorial cross posted on Movalog and Learning Movable Type If you move from static publishing to dynamic publishing in Movable Type, you may encounter a variety of confusing error messages in Smarty, the system MT uses to create its...</summary>
   <author>
      <name>Arvind Satyanarayan</name>
      <uri>http://www.movalog.com/</uri>
   </author>
   
      <category term="Dynamic Publishing" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="dynamicpublishing" label="Dynamic Publishing" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="smarty" label="Smarty" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://www.learningmovabletype.com/">
      <![CDATA[<p><em>This tutorial is written by LMT contributor Arvind Satyanarayan of <a href="http://www.movalog.com/">Movalog</a>.<br />
Tutorial cross posted on <a href="http://www.movalog.com/archives/dynamic/troubleshooting-smarty-errors/">Movalog</a> and Learning Movable Type</em></p>

<p>If you move from static publishing to dynamic publishing in Movable Type, you may encounter a variety of confusing error messages in Smarty, the system MT uses to create its dynamic pages.  This tutorial will explore several of the errors you may experience, explain what they mean, and show you how to solve them.  This is by no means a complete guide to every error you may experience; I will continue to add to this tutorial as I come by more of them.</p>]]>
      <![CDATA[<h3>The Basics</h3>

<p>Many of the error messages you may see will take the format:</p>

<pre>Smarty Error: [in mt:## line:##]</pre>

<p>This error message provides useful information that can help you troubleshoot the problem.  The first numbers after <code>mt:</code> give the template_id of the template that contains the error.  Using this template ID, you can tweak the address of mt.cgi to take you to the Edit Template page for the template in question.  (See the example a few paragraphs down.)</p>

<p>The next part of the error message narrows down the error even further by telling you the specific line on which the error has occurred.  I use a text editor called <a href="http://www.ultraedit.com">UltraEdit</a> to edit my templates which provides line numbers.  Line numbers aren't available within the MT UI but you can copy the code to a text editor that has line numbering capabilities.</p>

<p>For example, if this were the start of an error message:</p>

<pre>Smarty Error: [in mt:16 line:200]</pre>

<p>you would point your browser to http://path/to/mt.cgi?__mode=view&_type=template&id=<strong>16</strong>&blog_id=<strong>1</strong> where 16 is the template ID and 1 is the blog_id for the blog (you can find this out by navigating to your blog's main menu and looking at the address bar). You could then copy the template body into a text editor with line numbering capabilities to find line 200 and the location of the error. </p>

<p><br />
<h3>Error Messages</h3></p>

<p><strong>Directory Not Found</strong></p>

<p>Example:</p>

<p><code>Smarty error: the $compile_dir '/home/blahblah/www/blog/templates_c' does not exist, or is not a directory.</code></p>

<p>You must create a directory called templates_c and assign it with permissions of 777. Your templates will be compiled in this directory. If you have added directives in mtview.php to <a href="http://www.sixapart.com/movabletype/docs/mtmanual_dynamic#pagelevel%20caching">cache</a> the templates, you may get a similar message but telling you the cache directory hasn't been created. To resolve this error, you will need to create a directory called <code>cache</code> with permissions of 777. </p>

<p><br />
<strong>Unrecognized Tag</strong></p>

<p>Example:</p>

<p><code>Smarty error: [in mt:16 line 21]: syntax error: unrecognized tag 'MTEntryProtect' (Smarty_Compiler.class.php, line 556)</code></p>

<p>This is one of the most common error messages experienced while moving to the dynamic system, especially if you have a heavily customized template.</p>

<p>These errors occur because the dynamic system is written in PHP and tags (whether they are provided by MT or by a plugin) must be ported to PHP before they will work in the dynamic system. Plugins must contain PHP files for the tags or else you cannot use them with MT's dynamic system.</p>

<p>To resolve this error, you can do one of two things. You can put the template code, where applicable, into a separate index template, publish that template statically, and then include the code snippet template's output file into your original template using the following bit of Smarty code</p>

<p><code language="PHP">{{include "/path/to/static.php"}}</code></p>

<p>Or, if you cannot put the tag into a separate file, you will have to remove the tag or find a PHP port of the tag to use in your template. </p>

<p><br />
<strong>Modifier Errors</strong></p>

<p>Example:</p>

<p><code>Smarty error: [plugin] modifier 'markdown' is not implemented (core.load_plugins.php, line 118)</code></p>

<p>Global (or text) filters are called "Modifiers" in Smarty language. This error is similar to the unrecognized tag in that Smarty is unable to find a PHP port of the modifier. All filters must also have a PHP port if they are to work with the dynamic templating. You can find PHP ports of Markdown, Smartypants and Textile <a href="http://www.movalog.com/archives/dynamic/breaking-plugins/">here</a>. If you are unable to find a PHP port for your filter, the only resolution is to either remove the syntaxing the modifier provides (for example with Smartypants you'll need to remove smartypants="1") or select another filter  that does have PHP port. </p>

<p><br />
<strong>Unclosed Tag</strong></p>

<p>For example </p>

<p><code>Smarty error: [in mt:285 line 1]: syntax error: unclosed tag {MTComments} (opened line 1). (Smarty_Compiler.class.php, line 308)</code></p>

<p>This is quite an easy error to understand. Basically you've forgotten to close a container tag. With the above example, I've forgotten the &lt;/MTComments&gt; tag.  The error message even tells you where you opened the container tag!</p>

<p><br />
<strong>Mismatched Tag</strong></p>

<p>For example</p>

<p><code>Smarty error: [in mt:285 line 3]: syntax error: mismatched tag {/MTComments}. expected {/MTCommentEntry} (opened line 2). (Smarty_Compiler.class.php, line 2211)</code></p>

<p>This error simply means that you've prematurely closed one of the container tags forgetting to close one that was underneath it. With the above example, this is the code that caused it </p>

<p><code>&lt;MTComments&gt;<br />
&lt;MTCommentEntry&gt;<br />
&lt;/MTComments&gt;</code></p>

<p>As can be seen, I forgot to close the MTCommentEntry container tag. Again the error message is helpful and gives you the line where the unclosed container tag is. </p>

<p><br />
<strong>Unprocessed PHP</strong></p>

<p>If you are using PHP in your templates and suddenly find that the PHP code isn't being parsed, make sure that you are using the full PHP tags, i.e.</p>

<pre>&lt;?php ... ?&gt;</pre>

<p>as opposed to</p>

<pre>&lt;? ... ?&gt;</pre>

<p>Also, you cannot use normal MT Tags within blocks of PHP code. If you wish to use MT Tags within blocks of PHP, you must call their PHP counterpart. For example, if I wanted to use &lt;MTEntryBody&gt; within PHP code, I would need to use this instead. </p>

<pre>$this->tag('MTEntryBody');</pre>

<p><br />
<strong>PHP Errors</strong></p>

<p>You may also come across a variety of PHP errors that are horribly unhelpful. I would recommend you read <a href="http://www.devarticles.com/c/a/PHP/Making-Sense-Of-PHP-Errors/">Making Sense of PHP Errors</a> to help you understand what the errors mean and how to resolve them. </p>

<p><br />
<h3>Other Tips</h3></p>

<p>I use a lot of PHP in my templates and often I find it easier to troubleshoot errors by viewing the template after Smarty has finished generating the template. This is when I use the files in the templates_c directory. This directory contains the templates that Smarty has compiled. The file names can be difficult to decipher but the important part is the ending of the file name. It will look something like this</p>

<pre>mt%3A</pre>

<p>followed a number and then the extension (.php). The number is the id of the template.  Therefore if I wanted to see the output of template whose id is 14, I would open the file that ended </p>

<pre>mt%3A14.php</pre>

<p>I wouldn't recommend you tweak things directly here however.   If you were to make a mistake you could potentially delete the file and within MT initiate a rebuild of all files. </p>

<h3>Further Reading:</h3>

<ul><li><a href="http://www.sixapart.com/pronet/articles/dynamic_publish.html">Dynamic Publishing: PHP Architecture Overview</a> - Useful information on how the dynamic system works.</li>
<li><a href="http://www.sixapart.com/pronet/articles/php_dynamic_pub.html">PHP Dynamic Publishing: Developing Plugins</a> - Information on how to develope plugins for the PHP system</li>
<li><a href="http://www.sixapart.com/pronet/articles/how_to_speed_up.html">How to Speed Up Publishing in Movable Type</a> - Useful tips on migrating to the dynamic templating. </li></ul>]]>
   </content>
</entry>

<entry>
   <title>An Overview of the MT Program File Directories</title>
   <link rel="alternate" type="text/html" href="http://www.learningmovabletype.com/a/000954overview_mt_directories/" />
   <id>tag:www.elise.com,2005:/mt//10.954</id>
   
   <published>2005-02-03T08:36:38Z</published>
   <updated>2007-06-22T05:36:23Z</updated>
   
   <summary>What do all these folders do? This tutorial is written by LMT contributor Arvind Satyanarayan of Movalog. There are several folders in the default distribution of Movable Type. This tutorial will attempt to guide you through them all so that you feel more comfortable with what they do and contain....</summary>
   <author>
      <name>Arvind Satyanarayan</name>
      <uri>http://www.movalog.com/</uri>
   </author>
   
      <category term="Install" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="directories" label="Directories" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="file" label="File" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="mt" label="MT" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="program" label="Program" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://www.learningmovabletype.com/">
      <![CDATA[<h2>What do all these folders do?</h2>

<p><em>This tutorial is written by LMT contributor Arvind Satyanarayan of <a href="http://www.movalog.com/">Movalog</a>.</em></p>

<p>There are several folders in the default distribution of Movable Type. This tutorial will attempt to guide you through them all so that you feel more comfortable with what they do and contain. </p>

<h2>extlib/</h2>

<p>This directory contains perl libraries and files that support Movable Type. These are the modules that are needed by Movable Type to run (for example those modules listed in mt-check.cgi are normally found here) Some plugins also require some special perl modules to be installed, and normally you can install these perl modules into the extlib/ directory. For example, the <a href="http://nilesh.org/mt/blogtimes/">BlogTimes</a> plugin requires the GD perl module to be installed. Obviously you can get your host to install it and then that module would be available server wide. However, if you uploaded the files provided on the BlogTimes page into your extlib/ directory, you would have the GD module installed just for your installation without having to go to your host.<br />
 <br />
The extlib/ directory, however, can't handle everything. Many modules still need to be installed by your host for example Image::Magick or the Storable module can't be installed into the extlib/ directory as they require compilation.</p>

<p>You should never have to change the contents of files located in this directory if you ever apply a hack. </p>]]>
      <![CDATA[<h2>lib/</h2>

<p>This contains your core Movable Type files. These files are Movable Type, they are what run the different processes for example rebuilding, commenting etc. Everything you see in the Movable Type interface and everything that Movable Type does is defined here in perl. Within lib/, we have a few more directories.</p>

<p><b>lib/MT/</b></p>

<p>This subdirectory inside lib/ contains the MT API and several subdirectories that directly control Movable Type. The files in lib/MT/ are known as the <a href="http://www.sixapart.com/movabletype/docs/mtapi_index">MT API</a> (or Application Program Interface). These files allow things to interact with Movable Type and its database, this includes the actual core MT files or a desktop client like w.bloggar. </p>

<p><strong>lib/MT/App/</strong></p>

<p>The most important directory is App/. The App/ directory contains perhaps the most important files in Movable Type. These files define Movable Type and how it works. Most of your hacks will be changing the files in this directory. It also contains default-templates.pl, as the name suggests, this file is called and its values define the default templates when you either create a new blog or reset templates in an existing blog. </p>

<p><strong>lib/MT/FileMgr/</strong></p>

<p>As the name suggests, this folder contains the perl module responsible for all physical files generated by MT whether it be static entry pages, templates or HTML files generated by selecting the popup attribute in the upload dialog. Changes to this file will affect the files generated by MT. </p>

<p><strong>lib/MT/L10N/</strong></p>

<p>L10N (or l10n as you mostly see it as) is another way of saying localization -- the term l10n is formed by the first and last letter of the word and the number of letters in between. This directory contains all your language modules used when building the MT interface. For example the English distribution of Movable Type will contain en_us.pm that will render the Movable Type interface in English.</p>

<p><strong>lib/MT/ObjectDriver/</strong></p>

<p>The files and folders under this directory allow MT to interact with its database. In the default installation, you have modules allow MT to interact with Berkely DB, mySQL, PostgreSQL and SQL::Lite. If you wanted to use another database, the first thing you would need to do is create a file in this directory to correspond to your database type. </p>

<p><strong>lib/MT/Template/</strong></p>

<p>The name of this folder gives you a clue to what it does. The file in here defines the template tags available by default in Movable Type. If you wanted to add a tag into MT without writing a plugin, you would need to do it here. </p>

<h2>plugins/</h2>

<p>This folder may not exist on your server and will need to be created if you ever install <a href="http://www.sixapart.com/pronet/plugins/">a plugin.</a></p>

<h2>schemas/</h2>

<p>This folder contains files used during mt-load.cgi to create the database, tables, relationships etc. Again if you wished to have MT interact with another database, you would need to create a schemas to load the MT database into it. </p>

<h2>search_templates/</h2>

<p>As the name suggests, this folder contains the templates used by MT when a search is performed. You can learn more about using search templates <a href="http://www.learningmovabletype.com/archives/000651mt_keyword_search.php">here</a></p>

<h2>tools/</h2>

<p>This folder contains scripts that can be run outside of MT to interact with MT. An example would be the run-periodic-tasks file. This file can be used in a cron command to run the scheduling posting script. Similarly other scripts can be cronned and used. </p>

<h2>examples/</h2>

<p>This folder contains some sample plugins by Ezra that basically highlight the new plugin architecture in Movable Type 3. </p>

<h2>php/</h2>

<p>This directory contains all the PHP files for the dynamic templating system introduced in Movable Type 3.1. Within it there are three folders, extlib/, lib/ and plugins/ and function exactly as their perl counterparts. extlib/ contains the Smarty templating and other PHP files to create a PHP instance of Movable Type and interact with the database. The lib/ directory contains all the PHP ports of the template tags while the plugins/ directory will contain PHP plugins. </p>

<h2>docs/</h2>

<p>This directory contains html files and images that is basically your copy of the MT Manual. Its pages are referenced throughout MT with the little Question Mark in a box. If you have installed MT in your cgi-bin/ you will need to move this folder out of it, in a StaticWebPath. </p>

<h2>images/</h2>

<p>This directory contains images used by MT in the web based interface (mt.cgi) This will also need to be in your StaticWebPath if you have installed MT in your cgi-bin/</p>]]>
   </content>
</entry>

<entry>
   <title>Scheduled Postings and Cron Jobs</title>
   <link rel="alternate" type="text/html" href="http://www.learningmovabletype.com/a/000757scheduled_posts/" />
   <id>tag:www.elise.com,2004:/mt//10.757</id>
   
   <published>2004-09-24T09:21:33Z</published>
   <updated>2007-06-22T05:36:23Z</updated>
   
   <summary>Co-authored by Elise Bauer and Arvind Satyanarayan. Tutorial cross posted on Movalog and Learning Movable Type Future posting is a convenient new feature in MT3.1x, allowing you to create an entry and have it automatically post at a future time. But before you can use this feature you need to...</summary>
   <author>
      <name>Arvind Satyanarayan</name>
      <uri>http://www.movalog.com/</uri>
   </author>
   
      <category term="General Tips and Tricks" scheme="http://www.sixapart.com/ns/types#category" />
   
      <category term="Servers" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="chronjob" label="Chron Job" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="futureposts" label="Future Posts" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="schedulingposts" label="Scheduling Posts" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://www.learningmovabletype.com/">
      <![CDATA[<p><em>Co-authored by <a href="http://www.elise.com">Elise Bauer</a> and <a href="http://www.movalog.com">Arvind Satyanarayan</a>.<br />
Tutorial cross posted on <a href="http://www.movalog.com/archives/general/scheduled-postings-and-cron-jobs/">Movalog</a> and <a href="http://www.learningmovabletype.com/archives/000757scheduled_postings_and_cron_jobs.php">Learning Movable Type</a></em></p>

<p>Future posting is a convenient new feature in MT3.1x, allowing you to create an entry and have it automatically post at a future time.  But before you can use this feature you need to set up a <strong>Cron Job</strong> on your server.</p>

<h3>What is a Cron Job?</h3>

<p>Cron is a task scheduler for unix servers.  A cron job is a specific task that runs a certain number of times per minute, day, week, or month on your server.  For example, you can use a cron job to automate a daily MySQL database backup.  The main problem with cron jobs is that if they aren't properly configured they can cause high server loads which may result in suspension of your site with your web host.  If you are able, configure your cron job so that the results of running the scheduled script are emailed to you.</p>

<p>There are two main ways by which you create a cron job on your server: cPanel, and using shell access to your server. Cpanel is the easiest way; shell access requires knowledge of UNIX editing commands and should only be attempted by those familiar with such commands.</p>]]>
      <![CDATA[<h3>Using cPanel</h3>

<p>If your webhost has cPanel installed, search for the cron command in cPanel.  You may be presented with a page where you select your experience level - standard or advanced.  Presented are instructions for both.</p>

<h3>Standard</h3>

<p>Using the standard function in cPanel, the cron job editing screen should look something like this:</p>

<div align="center">
<a href="http://www.learningmovabletype.com/images/cronstandard_1.png" onclick="window.open(this.href, '_blank', 'width=640,height=457,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img alt="Cronstandard_1" title="Cronstandard_1" src="http://www.learningmovabletype.com/images/cronstandard_1.png" width="100" height="71" border="1" style="margin: 0px 5px 5px 0px;" /></a>
(click to view)
</div>

<p>Your email needs to go in the textbox at the top of the screen so that the results of running the script are emailed to you. The command to be run is</p>

<p><code>cd &lt;path to mt&gt;; ./tools/run-periodic-tasks</code></p>

<p><br />
Substitute &lt;path to mt&gt; with the path to your MT cgi files.</p>

<p>For example, if your MT installation is in your cgi bin, it might look like this:</p>

<p><code>cd /home/username/cgi-bin/; ./tools/run-periodic-tasks</code></p>

<p><br />
If your MT installation is in your public_html directory, it could look like this:</p>

<p><code>cd /home/username/public_html/path/to/mt/; ./tools/run-periodic-tasks</code></p>

<p><br />
It should be set to run every 15 minutes of every hour, every day, every weekday and every month.</p>

<h3>Advanced</h3>

<p>Using the Advanced function in cPanel, you will be presented with a different screen.  Fill it out as shown below:</p>

<div align="center"><a href="http://www.learningmovabletype.com/images/cronadvanced_2.png" onclick="window.open(this.href, '_blank', 'width=640,height=249,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img alt="Cronadvanced_2" title="Cronadvanced_2" src="http://www.learningmovabletype.com/images/cronadvanced_2.png" width="100" height="38" border="1" style="margin: 0px 5px 5px 0px;" /></a>
(click to view)

</div>

<p>Substitute "arvinds" with your email at the top. The cron should be set to run<br />
 */15 * * * * (every fifteen minutes of every hour of every day, every weekday, every month). The command to be run is </p>

<p><code>cd &lt;path to mt&gt;; ./tools/run-periodic-tasks</code></p>

<p><br />
<h3>Using Shell Access</h3></p>

<p>The Shell Access method is explained in the MT Manual.  At the time of this writing, although the steps outlined in the manual are correct, the crontab command is not.  </p>

<p>1. Log into your server.</p>

<p>2. Get into your crontab editor</p>

<p><code>crontab -e</code></p>

<p><br />
3. Add the following command:</p>

<p><code>0,15,30,45 * * * * cd &lt;path to mt&gt;; ./tools/run-periodic-tasks</code></p>

<p><br />
Where your path to mt is your specific path to your MT files.</p>

<p>This command instructs cron to run the script every 15 minutes of every hour of every day.  Make sure this command is exactly as written.</p>

<h3>Troubleshooting</h3>

<p>There have been many errors experienced during setting this up. The first being an MT.pm error. At the time of writing this tutorial, <a href="http://www.movabletype.org/docs/mtmanual_advanced.html#scheduled%20posting">the documentation</a> was incorrect as the command to be run was not correct. Make sure you use the command to run as shown in this tutorial.</p>

<p>If you get a permission denied error make sure the run-periodic-tasks script has 755 permissions (the same permissions as all the cgi files)</p>

<p>If you get the error message:</p>

<blockquote>
You have scheduled posts but have not entered a Remote Services username in your profile, or you don't have a Movable Type proof-of-purchase. You need to do so before scheduled posts will be released.
</blockquote>

<p>This is a weird bug in MT at the moment.  This error message does not affect anything.  You can ignore it.</p>

<h3>Scheduling Posts</h3>

<p>With the cron job set up you are now ready to schedule your weblog posts.  On the Edit Entry page of the entry that you would like to schedule for a future posting, scroll down to the bottom of the page to where you see "Post Status".</p>

<p><img alt="post_schedule.gif" src="http://www.learningmovabletype.com/images/post_schedule.gif" width="187" height="117" /></p>

<p>You can now select "draft", "publish", or "future".  Select "future" and adjust the date and time for the date and time that you want the post published.</p>

<h3>Links:</h3>
<ul><li><a href="http://twiki.tensegrity.net/bin/view/Main/MovableTypeTrickle">MTTrickle</a> - automated posting of deferred MT Entries, for MT2.x
</li><li><a href="http://www.timaoutloud.org/code/mt/#mt-publish-on">MT-Publish-On</a> - Tim Appnel's code modification patches for MT2.64 to allow future posting.
</li><li><a href="http://www.scriptygoddess.com/archives/2002/08/02/pre-post-but-only-have-it-show-up-when-its-a-current-entry/">ScriptyGoddess's Pre-Post script</a></li></ul>

<p><br />
<div class="link-note">Copyright  2004 Elise Bauer and Arvind Satyanarayan.  </div></p>]]>
   </content>
</entry>

</feed>

