<?xml version="1.0" encoding="iso-8859-1"?>
<feed version="0.3" xmlns="http://purl.org/atom/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xml:lang="en">
<title>Girlie&apos;s Tips and Tricks</title>
<link rel="alternate" type="text/html" href="http://www.thegirliematters.com/tips/" />
<modified>2005-08-21T14:38:02Z</modified>
<tagline>tips and tricks for movable type</tagline>
<id>tag:www.thegirliematters.com,2007:/tips//7</id>
<generator url="http://www.movabletype.org/" version="3.2">Movable Type</generator>
<copyright>Copyright (c) 2005, girlie</copyright>
<entry>
<title>add shortcut to reset activity log</title>
<link rel="alternate" type="text/html" href="http://www.thegirliematters.com/tips/archives/0505/add_shortcut_to_reset_activity_log.php" />
<modified>2005-08-21T14:38:02Z</modified>
<issued>2005-05-07T17:20:54Z</issued>
<id>tag:www.thegirliematters.com,2005:/tips//7.426</id>
<created>2005-05-07T17:20:54Z</created>
<summary type="text/plain">In a previous mini-tip, I noted the URL to reset your Activity Log. With the introduction of magic tokens in...</summary>
<author>
<name>girlie</name>
<url>http://www.thegirliematters.com/</url>
<email>girlie@thegirliematters.com</email>
</author>
<dc:subject>hacks</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.thegirliematters.com/tips/">
<![CDATA[<p>In a previous mini-tip, I noted the <a href="http://www.thegirliematters.com/tips/mini/archives/0305/index.php#url_to_reset_ac" title="http://www.thegirliematters.com/tips/mini/archives/0305/index.php#url_to_reset_ac">URL to reset your Activity Log</a>. With the introduction of magic tokens in Movable Type 3.16, that method isn't going to work now.</p>

<p>Being that I'm lazy about resetting my own Activity Log, and that I'm often too impatient to wait for the log page to load all the way so I can get to the normal reset option at the very bottom, I just hacked a shortcut into the Main Menu of my Movable Type installation.</p>]]>
<![CDATA[<p>The file to modify is <code>tmpl/cms/list_blog.tmpl</code>. Look for the section of code that starts with this (at about line 45):</p>

<div class="codesample">&lt;TMPL_IF NAME=CAN_VIEW_LOG&gt;</div>

<p>and then right after this line:</p>

<div class="codesample">&lt;br style=&quot;clear: left;&quot; /&gt;</div>

<p>add the following:</p>

<div class="codesample">&lt;div class=&quot;label&quot;&gt;&lt;a href=&quot;&lt;TMPL_VAR NAME=SCRIPT_URL&gt;?__mode<span class="codeoomphb">&raquo;</span><br />
=reset_log&amp;magic_token=&lt;TMPL_VAR NAME=MAGIC_TOKEN&gt;&quot;&gt;<span class="codeoomphb">&raquo;</span><br />
&lt;MT_TRANS phrase=&quot;Reset Activity Log&quot;&gt;&lt;/a&gt;&lt;/div&gt;<br />
&lt;br style=&quot;clear: left;&quot; /&gt;
</div>

<p>(Line breaks added for display purposes are indicated by <span class="codeoomphb">&raquo;</span>; these breaks should be removed from the code!)</p>

<p>Save the file and upload it back to the server in <code>ASCII</code> mode.</p>

<p>Log into Movable Type and you should now see the link in the Shortcuts:</p>

<p><img class="imginline" alt="resetlog.gif" src="http://www.thegirliematters.com/tips/archives/images/resetlog.gif" width="173" height="78" /></p>]]>
</content>
</entry>
<entry>
<title>dynamic archives by author</title>
<link rel="alternate" type="text/html" href="http://www.thegirliematters.com/tips/archives/0501/dynamic_archives_by_author.php" />
<modified>2005-08-21T11:24:59Z</modified>
<issued>2005-01-23T21:22:30Z</issued>
<id>tag:www.thegirliematters.com,2005:/tips//7.414</id>
<created>2005-01-23T21:22:30Z</created>
<summary type="text/plain">The ability to provide archive listings by author has been a much requested option for Movable Type. While you can...</summary>
<author>
<name>girlie</name>
<url>http://www.thegirliematters.com/</url>
<email>girlie@thegirliematters.com</email>
</author>
<dc:subject>tricks</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.thegirliematters.com/tips/">
<![CDATA[<p>The ability to provide archive listings by author has been a much requested option for Movable Type. While you can create a separate index template (using the <code>author</code> attribute on <code>MTEntries</code>) for each author, if you have a lot of them, this becomes a pain to manage (not to mention the negative impact on your rebuilds). </p>

<p>The new dynamic publishing feature, which harnesses the power of <a href="http://smarty.php.net/" title="Smarty home page">Smarty</a>, takes us a few steps closer: you only need a single index template, and then you can just pass the appropriate author name as a variable to the page to limit the listing to that author's entries.</p>]]>
<![CDATA[<p>Create a new index template named <code>By Author</code> (be sure to enable dynamic building), using the following code:</p>

<div class="codesample">&lt;ul&gt;<br />
&lt;MTEntries author=&quot;`$smarty.request.author`&quot; lastn=&quot;9999&quot;&gt;<br />
&lt;li&gt;&lt;a href=&quot;&lt;$MTEntryPermalink valid_html=&quot;1&quot;$&gt;&quot;&gt;&lt;$MTEntryTitle$&gt;&lt;/a&gt;&lt;/li&gt;<br />
&lt;/MTEntries&gt;<br />
&lt;/ul&gt;
</div>

<p>Set the output file path (I used <code>authors/index.php</code>) and save the template.</p>

<p>Then, link to the author-specific listing like this:</p>

<div class="codesample">&lt;MTBlogURL&gt;authors/index.php?author=<span class="codeoomph">girlie</span></div>

<p>(Replace <span class="codeoomph">girlie</span> with your author name, of course.)</p>

<p>You can also generate a listing for all authors with the <a href="http://www.mt-plugins.org/archives/entry/authors.php" title="MTAuthors plugin page">MTAuthors plugin</a>, but since it's not yet been updated for dynamic publishing, you'll need to use a static page for this. Because commenter names are also stored in the <code>mt_author table</code> now, and some real authors may not have posted any entries yet, I also relied upon the <a href="http://www.mt-plugins.org/archives/entry/compare.php" title="Compare plugin page">Compare plugin</a>, to make sure the author actually has some entries.</p>

<p>Here's the code for the listing:</p>

<div class="codesample">&lt;h2&gt;Archives by Author&lt;/h2&gt;<br />
&lt;ul&gt;<br />
&lt;MTAuthors&gt;<br />
&lt;MTIfNotEqual a=&quot;[MTAuthorEntryCount]&quot; b=&quot;0&quot; numeric=&quot;1&quot;&gt;<br />
&lt;li&gt;&lt;a href=&quot;&lt;MTLink template=&quot;<span class="codeoomph">By Author</span>&quot;&gt;?author=&lt;MTAuthorName&gt;&quot;&gt;&lt;MTAuthorName&gt;&lt;/a&gt;&lt;/li&gt;<br />
&lt;/MTIfNotEqual&gt;<br />
&lt;/MTAuthors&gt;<br />
&lt;/ul&gt;
</div>

<p>Replace <span class="codeoomph">By Author</span> with the name of the first template you created, to automatically generate the proper link for that template's output file.</p>

<p>If your <code>Main Index Template</code> is published dynamically (and you want to keep it that way), use a separate static index template for the author listing, and then just include the output file in your <code>Main Index Template</code>:</p>

<div class="codesample">&lt;?php (&quot;/full/path/to/included/file/authors.inc&quot;); ?&gt;</div>

<p>Props to <a href="http://www.bradchoate.com/">Brad</a> once again - although the questions I asked him weren't for this purpose, his patient explanations are always so informative that I can't help but be inspired!</p>]]>
</content>
</entry>
<entry>
<title>paginated dynamic index page with smarty</title>
<link rel="alternate" type="text/html" href="http://www.thegirliematters.com/tips/archives/0411/paginated_dynamic_index_page_with_smarty.php" />
<modified>2006-06-08T14:50:34Z</modified>
<issued>2004-11-06T18:38:19Z</issued>
<id>tag:www.thegirliematters.com,2004:/tips//7.412</id>
<created>2004-11-06T18:38:19Z</created>
<summary type="text/plain">Using Smarty to paginate your index template when publishing dynamically.</summary>
<author>
<name>girlie</name>
<url>http://www.thegirliematters.com/</url>
<email>girlie@thegirliematters.com</email>
</author>
<dc:subject>tricks</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.thegirliematters.com/tips/">
<![CDATA[<p><a href="http://www.bradchoate.com" title="visit Brad's site">Brad</a> gave me this Smarty code for paginating an index page (i.e., where you can have previous/next links with a certain number of entries per page).</p>]]>
<![CDATA[<p>Above the primary <code>&lt;MTEntries&gt;</code> container in your page, use something like this:</p>

<div class="codesample">&lt;p align=&quot;right&quot;&gt;<br />
 {{if $smarty.request.start &gt; 0}}<br />
 &lt;a href=&quot;?start={{$smarty.request.start-<span class="codeoomph">5</span>}}&quot;&gt;Previous&lt;/a&gt;<br />
 {{/if}}<br />
 <br />
 &lt;MTEntries lastn=&quot;1&quot; offset=&quot;`$smarty.request.start+<span class="codeoomph">5</span>`&quot;&gt;<br />
 {{if $smarty.request.start &gt; 0}} | {{/if}}<br />
 &lt;a href=&quot;?start={{$smarty.request.start+<span class="codeoomph">5</span>}}&quot;&gt;Next&lt;/a&gt;<br />
 &lt;/MTEntries&gt;<br />
 &lt;/p&gt;
</div>

<p>and then modify the primary <code>&lt;MTEntries&gt;</code> tag to look like this:</p>

<div class="codesample">&lt;MTEntries lastn="<span class="codeoomph">5</span>" offset=&quot;`$smarty.request.start`&quot;&gt;
</div>

<p>You can change <span class="codeoomph">5</span> to the number of entries you want per page.</p>

<p>I really need to learn more about Smarty. Brad says there are a lot of neat things you can do with it, and Lord knows I haven't spent much time lately just doing &quot;neat things&quot;. :p </p>

<p>(Which means don't bother asking me too many questions about this. I have no idea how the hell it works - I'm just documenting the code before I forget about it.)</p>]]>
</content>
</entry>
<entry>
<title>per-category individual entry archive templates</title>
<link rel="alternate" type="text/html" href="http://www.thegirliematters.com/tips/archives/0410/percategory_individual_entry_archive_templates.php" />
<modified>2005-08-21T11:24:59Z</modified>
<issued>2004-10-16T13:32:50Z</issued>
<id>tag:www.thegirliematters.com,2004:/tips//7.408</id>
<created>2004-10-16T13:32:50Z</created>
<summary type="text/plain">Generate unique individual archives based on the entry&apos;s primary category.</summary>
<author>
<name>girlie</name>
<url>http://www.thegirliematters.com/</url>
<email>girlie@thegirliematters.com</email>
</author>
<dc:subject>tricks</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.thegirliematters.com/tips/">
<![CDATA[<p>Stepan Riha showed us how to have <a href="http://www.nonplus.net/software/mt/Per-CategoryTemplates.htm" title="Stepan Riha's Per-Category Templates">Per-Category Templates for Category Archives</a>. You can do the same thing for Individual Entry Archives, you just need a different plugin. </p>]]>
<![CDATA[<p>Install the <a href="http://mt-plugins.org/archives/entry/compare.php" title="Kevin Shay's Compare plugin">Compare plugin</a>.</p>

<p>Create a separate <code>Template Module</code> for each category which contains the appropriate content and template code you want for entries in that particular category. </p>

<p>Replace your existing Individual Entry Archive template with code similar to this (substituting your own category names, of course):</p>

<div class="codesample">&lt;MTIfEqual a=&quot;[MTEntryCategory]&quot; b=&quot;Apples&quot;&gt;<br />
 &lt;MTInclude module=&quot;Apples&quot;&gt;<br />
&lt;/MTIfEqual&gt;<br />
&lt;MTIfEqual a=&quot;[MTEntryCategory]&quot; b=&quot;Bananas&quot;&gt;<br />
 &lt;MTInclude module=&quot;Bananas&quot;&gt;<br />
&lt;/MTIfEqual&gt;<br />
&lt;MTIfEqual a=&quot;[MTEntryCategory]&quot; b=&quot;Oranges&quot;&gt;<br />
 &lt;MTInclude module=&quot;Oranges&quot;&gt;<br />
&lt;/MTIfEqual&gt;
</div>

<p>Save and rebuild <code>Individual Archives</code>.</p>]]>
</content>
</entry>
<entry>
<title>notifications: single form for subscribe and unsubscribe</title>
<link rel="alternate" type="text/html" href="http://www.thegirliematters.com/tips/archives/0408/notifications_single_form_for_subscribe_and_unsubscribe.php" />
<modified>2005-08-21T11:24:58Z</modified>
<issued>2004-08-22T04:54:32Z</issued>
<id>tag:www.thegirliematters.com,2004:/tips//7.398</id>
<created>2004-08-22T04:54:32Z</created>
<summary type="text/plain">unsubscribe, notifications, subscribe, notify list</summary>
<author>
<name>girlie</name>
<url>http://www.thegirliematters.com/</url>
<email>girlie@thegirliematters.com</email>
</author>
<dc:subject>tricks</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.thegirliematters.com/tips/">
<![CDATA[<p>One new feature in Movable Type 3.0 which hasn't received much attention is the unsubscribe function for notifications. Visitors who've added themselves to your notification list can now unsubscribe themselves, if you provide a form for them to do so.</p>

<p>Rather than have two forms, one for subscribing and one for unsubscribing, you can combine these functions into a single form.</p>]]>
<![CDATA[<div class="codesample">&lt;h2&gt;Notify List&lt;/h2&gt;<br />
&lt;div class=&quot;link-note&quot;&gt;<br />
&lt;form method=&quot;post&quot; action=&quot;&lt;$MTCGIPath$&gt;mt-add-notify.cgi&quot;&gt;<br />
&lt;input type=&quot;hidden&quot; name=&quot;blog_id&quot; value=&quot;&lt;$MTBlogID$&gt;&quot; /&gt;<br />
&lt;input type=&quot;hidden&quot; name=&quot;_redirect&quot; value=&quot;&lt;$MTBlogURL$&gt;&quot; /&gt;<br />
&lt;input name=&quot;email&quot; size=&quot;20&quot; /&gt;&lt;br /&gt;<br />
&lt;input type=&quot;radio&quot; name=&quot;__mode&quot; value=&quot;subscribe&quot; /&gt;&amp;nbsp;<br />
&lt;label for=&quot;subscribe&quot;&gt;subscribe&lt;/label&gt;&lt;br /&gt;<br />
&lt;input type=&quot;radio&quot; name=&quot;__mode&quot; value=&quot;unsubscribe&quot; /&gt;&amp;nbsp;<br />
&lt;label for=&quot;unsubscribe&quot;&gt;unsubscribe&lt;/label&gt;&lt;br /&gt;<br />
&lt;input type=&quot;submit&quot; value=&quot;update&quot; /&gt;<br />
&lt;/form&gt;<br />
&lt;/div&gt;
</div>

<p>Currently, new subscriptions must be confirmed via email; however, this is not required for a visitor to unsubscribe.</p>]]>
</content>
</entry>
<entry>
<title>more link on same line as body</title>
<link rel="alternate" type="text/html" href="http://www.thegirliematters.com/tips/archives/0404/more_link_on_same_line_as_body.php" />
<modified>2005-08-21T11:24:57Z</modified>
<issued>2004-04-05T14:48:41Z</issued>
<id>tag:www.thegirliematters.com,2004:/tips//7.359</id>
<created>2004-04-05T14:48:41Z</created>
<summary type="text/plain">Avoiding the default break between Entry Body and the More link.</summary>
<author>
<name>girlie</name>
<url>http://www.thegirliematters.com/</url>
<email>girlie@thegirliematters.com</email>
</author>
<dc:subject>tips</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.thegirliematters.com/tips/">
<![CDATA[<p>Many users want their more (or &quot;continue reading&quot;) link to appear right after their entry body, rather than being separated due to the paragraph tags MT inserts when you use the <code>Convert Breaks</code> formatting option.</p>

<p>This is what I wanted too when I ditched my splash page <a href="http://www.thegirliematters.com/" title="main page of my site">for a blog</a> instead. Here's the basic code I used in my &quot;previously&quot; section (with some additional formatting removed for clarity).</p>]]>
<![CDATA[<div class="codesample">&lt;MTAddRegex name=&quot;RemoveEndingCloseP&quot;&gt;s|&lt;/p&gt;\s*$||gi&lt;/MTAddRegex&gt;<br />
&lt;MTEntryIfExtended&gt;<br />
&lt;MTEntryBody regex=&quot;RemoveEndingCloseP&quot;&gt; &lt;a class=&quot;more&quot; href=&quot;&lt;MTEntryPermalink&gt;#more&quot; title=&quot;read the rest&quot;&gt;(more...)&lt;/a&gt;&lt;/p&gt;<br />
&lt;MTElse&gt;<br />
&lt;MTEntryBody&gt;<br />
&lt;/MTElse&gt;<br />
&lt;/MTEntryIfExtended&gt;
</div>

<p>The <a href="http://mt-plugins.org/archives/entry/regex.php" title="Regex plugin page">Regex plugin</a> code comes from &quot;houchin&quot; in <a href="http://www.movabletype.org/support/index.php?act=ST&amp;f=14&amp;t=37273" title="support forum topic">this support forum topic</a> (which is also what inspired the rest of the code).</p>

<p>Instead of having the Entry Body tag precede the test for an Extended Entry, everything goes inside the MTEntryIfExtended container. If there is extended text, the closing paragraph tag is removed by the Regex statement from the Entry Body, then coded back in to appear after the <i>more</i> link. If there is no Extended Entry, the Entry Body is presented normally.</p>

<p>And just in case it wasn't clear, you do have to <i>install</i> the Regex plugin if you expect this to work. ;-)</p>]]>
</content>
</entry>
<entry>
<title>categories with most entries</title>
<link rel="alternate" type="text/html" href="http://www.thegirliematters.com/tips/archives/0404/categories_with_most_entries.php" />
<modified>2005-08-21T11:24:57Z</modified>
<issued>2004-04-04T08:01:07Z</issued>
<id>tag:www.thegirliematters.com,2004:/tips//7.358</id>
<created>2004-04-04T08:01:07Z</created>
<summary type="text/plain">Use PHP to produce a list of the categories with the most entries.</summary>
<author>
<name>girlie</name>
<url>http://www.thegirliematters.com/</url>
<email>girlie@thegirliematters.com</email>
</author>
<dc:subject>php</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.thegirliematters.com/tips/">
<![CDATA[<p>This is a total copycat of <a href="http://www.scriptygoddess.com/archives/001050.php" title="Scriptygoddess Entry">the Scriptygoddess Most Commented On Entries</a>, but I thought someone might find a use for it anyway. ;-)</p>

<p>Here, we'll use PHP to produce a list of the categories with the most entries.</p>]]>
<![CDATA[<p>Create a new Index Template with an output file of categories.inc with the following code in it:</p>

<div class="codesample">&lt;?php<br /> 
<br />
&lt;MTCategories&gt;$catentries[&lt;MTCategoryName&gt;] =<br /> &lt;MTCategoryCount&gt;;<br />
&lt;/MTCategories&gt;<br />
<br />
&lt;MTCategories&gt;$catinfo[&lt;MTCategoryName&gt;] =<br /> &quot;&lt;MTCategoryLabel&gt;|&lt;MTCategoryArchiveLink&gt;|&lt;MTEntries lastn=&quot;1&quot;&gt;&lt;MTEntryDate format=&quot;%m.%d&quot;&gt;&lt;/MTEntries&gt;&quot;;<br />
&lt;/MTCategories&gt;<br />
<br />
?&gt;
</div>

<p>Make sure the box is checked to <code>Rebuild this template automatically</code>. Save the template and then rebuild it.</p>

<p>Where you want the listing to display, use this code:</p>

<div class="codesample">&lt;?php<br />
<br />
# This is the path to the categories.inc:<br />
include(&quot;<span class="codeoomph">/full/path/to/categories.inc</span>&quot;);<br />
<br />
echo &quot;&lt;ul&gt;&quot;;<br />
<br />
# This is the number of results you want to show:<br />
$results = <span class="codeoomph">10</span>;<br />
<br />
array_multisort($catentries, SORT_DESC, $catinfo);<br />
$i = 0;<br />
do {<br />
$cats = explode(&quot;|&quot;, $catinfo[$i]);<br />
$cat_name = $cats[0];<br />
$cat_link = $cats[1];<br />
$cat_updated = $cats[2];<br />
<br />
echo &quot;&lt;li&gt;&lt;b&gt;$catentries[$i] entries&lt;/b&gt;: &lt;a href=\&quot;$cat_link\&quot;&gt;$cat_name&lt;/a&gt; (updated $cat_updated)&lt;/li&gt;&quot;;<br />
<br />
$i++;<br />
} while ($i&lt;$results);<br />
<br />
echo &quot;&lt;/ul&gt;&quot;;<br />
<br />
?&gt;
</div>

<p>Be sure to change <span class="codeoomph">/full/path/to/categories.inc</span> to point to the location of the new Index Template you created, and <span class="codeoomph">10</span> to the number of categories you want in the listing.</p>

<p><a href="http://www.thegirliematters.com/tips/demos/mostentcat.php" title="view the demo">View a demo of the results.</a></p>]]>
</content>
</entry>
<entry>
<title>2004 bloggies</title>
<link rel="alternate" type="text/html" href="http://www.thegirliematters.com/tips/archives/0401/2004_bloggies.php" />
<modified>2005-08-21T11:24:57Z</modified>
<issued>2004-01-22T03:01:24Z</issued>
<id>tag:www.thegirliematters.com,2004:/tips//7.357</id>
<created>2004-01-22T03:01:24Z</created>
<summary type="text/plain">The nominees for the 2004 Bloggies have been announced.</summary>
<author>
<name>girlie</name>
<url>http://www.thegirliematters.com/</url>
<email>girlie@thegirliematters.com</email>
</author>
<dc:subject>general</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.thegirliematters.com/tips/">
<![CDATA[<p>I just wanted to say what an honor it is to be nominated for two categories in <a href="http://www.fairvue.com/?feature=awards2004" title="see the nominees">this year's Bloggies</a>.</p>

<p>For a blog that started merely as a place for me to keep a personal list of &quot;things to do to my site&quot;, Tips &amp; Tricks has blossomed into something I never quite expected it to become. To know that other Movable Type users have found the information here helpful has been very gratifying, and has also challenged me to expand my own knowledge for the simple pleasure of sharing it with others.</p>

<p>I would like to encourage everyone to take some time to visit as many of the nominees as you can this year, and register your votes, whether for me or for &quot;the competition&quot;. I think it's safe to say that bloggers, like everyone else, appreciate recognition for what they do. The opportunities for showing that don't come along every day - so grab it while you can, along with the opportunity to discover some great reads you might not have been aware of until now.</p>

<p>Thanks to everyone who nominated me; to my fellow forum moderators; to the plugin developers; to the users who keep me hopping; and last, but most importantly, to Ben and Mena Trott for creating such an <a href="http://www.movabletype.org" title="movable type">inspiring product</a>! The Movable Type community is incredible, and I'm thrilled to be a part of it.</p>

<p>And good luck to my fellow nominees - I'm in excellent company, there's no doubt.</p>]]>

</content>
</entry>
<entry>
<title>category specific recent comments listing</title>
<link rel="alternate" type="text/html" href="http://www.thegirliematters.com/tips/archives/0401/category_specific_recent_comments_listing.php" />
<modified>2005-08-21T11:24:57Z</modified>
<issued>2004-01-17T01:32:44Z</issued>
<id>tag:www.thegirliematters.com,2004:/tips//7.356</id>
<created>2004-01-17T01:32:44Z</created>
<summary type="text/plain">How to show a category-specific recent comments listing in your Category Archives.</summary>
<author>
<name>girlie</name>
<url>http://www.thegirliematters.com/</url>
<email>girlie@thegirliematters.com</email>
</author>
<dc:subject>tricks</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.thegirliematters.com/tips/">
<![CDATA[<p>In <a href="http://www.thegirliematters.com/tips/archives/0309/lastn_comments_from_one_category.php" title="lastn comments from one category">a recent entry</a>, I showed how I used PHP/MySQL to display the <i>lastn</i> comments from a single category. The code can also be modified for use in a Category Archive page, to show recent comments only for <i>that particular</i> category.</p>]]>
<![CDATA[<p>This piece of code from the original entry is the one to modify:</p>

<div class="codesample">(placement_category_id = <span class="codeoomph">54</span>)
</div>

<p>If you only assign <b>one</b> category to each entry in your blog, replace <span class="codeoomph">54</span> with:</p>

<div class="codesample">&lt;MTEntries lastn=&quot;1&quot;&gt;<br />
&lt;MTEntryCategories&gt;<br />
&lt;MTCategoryID&gt;<br />
&lt;/MTEntryCategories&gt;<br />
&lt;/MTEntries&gt;
</div>

<p>If you assign <b>multiple</b> categories to each entry, install the <a href="http://mt-plugins.org/archives/entry/compare.php" title="Compare plugin">Compare plugin</a> and replace <span class="codeoomph">54</span> with:</p>

<div class="codesample">&lt;MTEntries lastn=&quot;1&quot;&gt;&lt;MTEntryCategories&gt;<br />
&lt;MTIfEqual a=&quot;[MTCategoryLabel]&quot; b=&quot;[MTEntryCategory]&quot;&gt;<br />
&lt;MTCategoryID&gt;&lt;/MTIfEqual&gt;&lt;/MTEntryCategories&gt;<br />&lt;/MTEntries&gt;
</div>

<p>Inspired by <a href="http://www.movabletype.org/support/index.php?act=ST&amp;f=14&amp;t=33827" title="MT support forum topic">this topic</a> in the MT forum.</p>]]>
</content>
</entry>
<entry>
<title>show all comments for comment author</title>
<link rel="alternate" type="text/html" href="http://www.thegirliematters.com/tips/archives/0401/show_all_comments_for_comment_author.php" />
<modified>2005-08-21T11:24:57Z</modified>
<issued>2004-01-04T21:41:32Z</issued>
<id>tag:www.thegirliematters.com,2004:/tips//7.355</id>
<created>2004-01-04T21:41:32Z</created>
<summary type="text/plain">Code to display all comments made by a particular author.</summary>
<author>
<name>girlie</name>
<url>http://www.thegirliematters.com/</url>
<email>girlie@thegirliematters.com</email>
</author>
<dc:subject>tricks</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.thegirliematters.com/tips/">
<![CDATA[<p>This PHP/MySQL code will list all comments made by a particular comment author (based on their email address - if you allow anonymous comments, you'll need to modify the code to use another field).</p>

<p>Also, the script uses the Trackback URL for each entry commented on to provide a permalink to the entry. If your entries aren't Trackback-enabled, you may get strange results.</p>

<p><b>Update 04.15.04:</b> The code has been updated to strip tags from comment text as a precautionary measure against malicious code.</p>]]>
<![CDATA[<div class="codesample">&lt;?<br />
//connection info<br />
include (&quot;<span class="codeoomph">/path/to/your/connection/file/connect.php</span>&quot;);<br />
<br />
$author = '<span class="codeoomph">girlie</span>';<br />
$email = '<span class="codeoomph">girlie&#64;thegirliematters&#46;com</span>';<br />
<br />
$leaders = mysql_query(&quot;SELECT comment_url, comment_author, comment_text, comment_created_on, comment_entry_id, entry_title, trackback_url FROM mt_comment, mt_entry, mt_trackback WHERE (comment_blog_id=<span class="codeoomph">8</span>) AND (comment_email='$email') AND (entry_id=comment_entry_id) AND (trackback_entry_id=comment_entry_id) ORDER BY comment_created_on DESC&quot;);<br />
<br />
$email=str_replace(&quot;@&quot;, &quot;&amp;#64;&quot;, &quot;$email&quot;);<br />
$email=str_replace(&quot;.&quot;, &quot;&amp;#46;&quot;, &quot;$email&quot;);<br />
echo &quot;Comments by &lt;a href=\&quot;$email\&quot;&gt;$author&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;\n&quot;;<br />
<br />
while($row = mysql_fetch_array($leaders)) {<br />
while (list($key,$val) = each($row)) {$$key = $val;}<br />
$date = date(&quot;m.d.y&quot;, strtotime($comment_created_on));<br />
$comment_text = strip_tags($row['comment_text']);<br />
echo &quot;posted $date on entry &lt;a href=\&quot;$trackback_url\&quot;&gt;$entry_title&lt;/a&gt;:\n&quot;;<br />
echo &quot;&lt;blockquote&gt;$comment_text&lt;/blockquote&gt;\n&quot;;<br />
}<br /> 
<br />
?&gt;
</div>

<p>You must change <span class="codeoomph">/path/to/your/connection/file/connect.php</span> to point to your <a href="http://www.thegirliematters.com/tips/demos/connectfile.php" onclick="window.open('http://www.thegirliematters.com/tips/demos/connectfile.php', 'popup', 'width=400,height=500,scrollbars=no,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false" title="popup instructions for a connect file">connect file</a>; change <span class="codeoomph">girlie</span> and <span class="codeoomph">girlie&#64;thegirliematters&#46;com</span> to match the comment author to display; and change <span class="codeoomph">8</span> to match your blog ID.</p>

<p>You can also <a href="http://www.thegirliematters.com/tips/demos/allcomments.php" title="view demo">view a demo</a> of the results (which is limited to 10 comments for the sake of brevity), and then <a href="http://www.virtualvenus.org/archives/0401/link_to_view_all_comments_for_comment_author.php" title="Virtual Venus entry">read a tutorial at Virtual Venus</a> on using the script dynamically for all comment authors.</p>]]>
</content>
</entry>
<entry>
<title>top searches using PHP and MySQL</title>
<link rel="alternate" type="text/html" href="http://www.thegirliematters.com/tips/archives/0311/top_searches_using_php_and_mysql.php" />
<modified>2005-08-21T11:24:57Z</modified>
<issued>2003-11-24T01:32:24Z</issued>
<id>tag:www.thegirliematters.com,2003:/tips//7.354</id>
<created>2003-11-24T01:32:24Z</created>
<summary type="text/plain">Displaying a list of top searches on your blog using MySQL and PHP.</summary>
<author>
<name>girlie</name>
<url>http://www.thegirliematters.com/</url>
<email>girlie@thegirliematters.com</email>
</author>
<dc:subject>tricks</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.thegirliematters.com/tips/">
<![CDATA[<p>I've already shown you how I display <a href="http://www.thegirliematters.com/tips/archives/0305/recent_searches_using_php_and_mysql.php" title="recent searches with PHP and MySQL">recent searches</a> on my blog. Here's how to display the <b>top</b> searches.</p>]]>
<![CDATA[<div class="codesample">&lt;?<br /> 
//connection info<br />
include (&quot;<span class="codeoomph">/path/to/your/connection/file/connect.php</span>&quot;);<br /><br />
// config<br /> 
$cgi_path = &quot;&lt;MTCGIPath&gt;mt-search.cgi&quot;;<br /> 
$show = 10;<br /><br />
$getlogs = &quot;SELECT log_message, log_created_on, COUNT(*) as log_count FROM mt_log GROUP BY log_message ORDER BY log_count DESC&quot;;<br /> 
$result = mysql_query($getlogs);<br /><br />
$i = 0;<br /> 
while ($row = mysql_fetch_array($result)) {<br /> 
$pos = strpos(($row['log_message']), &quot;Search: &quot;);<br /> 
if ($pos !== false) {<br /> 
$logs[$i] = str_replace(&quot;Search: query for &quot;, &quot;&quot;, ($row['log_message']));<br /> 
$logs[$i] = substr($logs[$i], 1, -1);<br />
$count[$i] = $row['log_count'];<br />
$i++;  if ($i == $show) {break;}<br />
}<br /> 
}<br /><br />
echo &quot;&lt;div class=\&quot;sidetitle\&quot;&gt;Top Searches&lt;/div&gt;&quot;;<br /> 
echo &quot;&lt;div class=\&quot;side\&quot;&gt;&quot;;<br /> 
for ($i=0; $i&lt;$show; $i++) {<br /> 
echo &quot;&amp;#8226; &lt;a href=\&quot;$cgi_path?search=$logs[$i]<span class="codeoomph">&amp;Template=tips&amp;IncludeBlogs=8</span>\&quot;&gt;$logs[$i]&lt;/a&gt; ($count[$i])&lt;br /&gt;&quot;;<br /> 
}<br />
echo &quot;&lt;/div&gt;\n&quot;;<br /> 
?&gt;
</div> 

<p>As before, you must change <span class="codeoomph">/path/to/your/connection/file/connect.php</span> to point to your <a href="http://www.thegirliematters.com/tips/demos/connectfile.php" onclick="window.open('http://www.thegirliematters.com/tips/demos/connectfile.php', 'popup', 'width=400,height=500,scrollbars=no,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false" title="popup instructions for a connect file">connect file</a>; and modify <span class="codeoomph">&amp;Template=tips&amp;IncludeBlogs=8</span> or remove it if it doesn't fit your needs.</p>

<p>I put both of these together for display on my <a href="http://www.thegirliematters.com/site/search.php" title="search the site">site search page</a>.</p>

<p><b>Related Links:</b></p>

<p>&#8226; <a href="http://www.thegirliematters.com/tips/archives/0305/recent_searches_using_php_and_mysql.php">recent searches using PHP and MySQL</a><br />
&#8226; <a href="http://mt-plugins.org/archives/entry/searches.php">MT Searches plugin</a></p>]]>
</content>
</entry>
<entry>
<title>&quot;mail this entry&quot; used for spam</title>
<link rel="alternate" type="text/html" href="http://www.thegirliematters.com/tips/archives/0311/mail_this_entry_used_for_spam.php" />
<modified>2005-08-21T11:24:57Z</modified>
<issued>2003-11-23T15:48:53Z</issued>
<id>tag:www.thegirliematters.com,2003:/tips//7.353</id>
<created>2003-11-23T15:48:53Z</created>
<summary type="text/plain">Using &quot;Mail This Entry&quot; is currently a risky proposition.</summary>
<author>
<name>girlie</name>
<url>http://www.thegirliematters.com/</url>
<email>girlie@thegirliematters.com</email>
</author>
<dc:subject>bugs</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.thegirliematters.com/tips/">
<![CDATA[<p><b>SEE UPDATE BELOW</b></p>

<p>If you are using Movable Type's "Mail This Entry" feature on your blog, you are advised to rename your mt-send-entry.cgi file, or remove the feature entirely.</p>

<p>If you are not using the feature on your blog, you still need to either rename the script, disable it by changing the permissions, or remove it from your server altogether.</p>

<p>Spammers have <a href="http://www.movabletype.org/support/index.php?act=ST&amp;f=14&amp;t=31153" title="MT Support Forum Topic">discovered a means</a> of using this script to send messages that will appear to be coming from <b>your</b> server. </p>

<p>Renaming the script won't prevent them from finding it if you continue to use the feature on your site, but it will slow them down a little if everyone chooses a unique name for the script.</p>

<p>Also, if you're using other versions of this feature such as <a href="http://www.davidgagne.net/code/archives/005317.shtml" title="David Gagne's Pop-Up eMail">Pop-Up Mail This Entry</a> or <a href="http://www.nonplus.net/software/mt/MT-Mail-Entry.htm" title="Stepan Riha's MT-Mail-Entry">MT-Mail-Entry</a>, you may want to take a similar approach to those as well.</p>

<p>If there are any developers out there interested in working on a fix for this vulnerability, please leave a comment and I will contact you with the details of the method being used (if you need them).</p>

<p><b>Update:</b> Ben posted a fix in the previously-mentioned forum thread:</p>

<p>Before line 40 in mt-send-entry.cgi, add these lines:</p>

<div class="codesample">die &quot;Invalid from or to value&quot;<br />
       if $to =~ /[\r\n]/ || $from =~ /[\r\n]/;
</div>

<p>Save mt-send-entry.cgi, upload to your server in ASCII mode, and CHMOD permissions to 755 again (if necessary).</p>

<p>(<i>Cross-posted at <a href="http://www.virtualvenus.org/archives/0311/mail_this_entry_used_for_spam.php" title="Virtual Venus Entry">Virtual Venus</a></i>)</p>]]>

</content>
</entry>
<entry>
<title>nicer autolinked urls in comments</title>
<link rel="alternate" type="text/html" href="http://www.thegirliematters.com/tips/archives/0311/nicer_autolinked_urls_in_comments.php" />
<modified>2005-08-21T11:24:57Z</modified>
<issued>2003-11-16T15:52:36Z</issued>
<id>tag:www.thegirliematters.com,2003:/tips//7.352</id>
<created>2003-11-16T15:52:36Z</created>
<summary type="text/plain">A hack to shorten the display of autolinked URLs in comments.</summary>
<author>
<name>girlie</name>
<url>http://www.thegirliematters.com/</url>
<email>girlie@thegirliematters.com</email>
</author>
<dc:subject>hacks</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.thegirliematters.com/tips/">
<![CDATA[<p><a href="http://www.movabletype.org" title="Movable Type">Movable Type</a> offers an autolink feature for URLs in comments, which is rather handy. However, if a URL is lengthy, it can mess up the display in other areas of your site (such as a Recent Comments Listing in your sidebar).</p>

<p>Dylan Cuthbert <a href="http://www.movabletype.org/support/index.php?act=ST&amp;f=12&amp;t=27411" title="support forum topic">posted a hack</a> that will extract just the site name as the text of the link.</p>]]>
<![CDATA[<p>You'll need to hack two MT files: lib/MT/Util.pm and lib/MT/Template/Context.pm (line numbers referenced are as of v2.64, and code changes are <span class="codeoomph">in color</span>):</p>

<p><b>lib/MT/Util.pm, lines 403-412:</b></p>

<div class="codesample">sub munge_comment {<br />
    my($text, $blog) = @_;<br />
    unless ($blog-&gt;allow_comment_html) {<br />
        $text = remove_html($text);<br />
        if ($blog-&gt;autolink_urls) {<br />
            <span class="codeoomph">$text =~ s!(http://([^\s/]+)\S*)!&lt;a href=&quot;$1&quot;&gt;$2&lt;/a&gt;!g;</span><br />
        }<br />
    }<br />
    $text;<br />
}
</div>

<p><b>lib/MT/Template/Context.pm, lines 1215-1230:</b></p>

<div class="codesample">sub _hdlr_comment_body {<br />
    my($ctx, $arg) = @_;<br />
    sanitize_on($arg);<br />
    my $tag = $ctx-&gt;stash('tag');<br />
    my $c = $ctx-&gt;stash($tag =~ /Preview/ ? 'comment_preview' : 'comment')<br />
        or return $ctx-&gt;_no_comment_error('MT' . $tag);<br />
    my $blog = $ctx-&gt;stash('blog');<br />
    my $t = defined $c-&gt;text ? $c-&gt;text : '';<br />
    <span class="codeoomph">$t = ($tag =~ /Preview/ ? $t : munge_comment($t, $blog) );</span><br />
    my $convert_breaks = exists $arg-&gt;{convert_breaks} ?<br />
        $arg-&gt;{convert_breaks} :<br />
        $blog-&gt;convert_paras_comments;<br />
    return $convert_breaks ?<br />
        MT-&gt;apply_text_filters($t, $blog-&gt;comment_text_filters, $ctx) :<br />
        $t;<br />
}
</div>

<p>I have not tested this hack personally (believe it or not, I do very little actual hacking to my own MT files). but I thought it was worth adding here and to the <a href="http://www.movabletype.org/support/?act=ST&amp;f=12&amp;t=12313&amp;#entry106124" title="requested features topic">Requested Features List</a>.</p>]]>
</content>
</entry>
<entry>
<title>more than five recent items on editing menu</title>
<link rel="alternate" type="text/html" href="http://www.thegirliematters.com/tips/archives/0311/more_than_five_recent_items_on_editing_menu.php" />
<modified>2005-08-21T11:24:57Z</modified>
<issued>2003-11-09T18:23:16Z</issued>
<id>tag:www.thegirliematters.com,2003:/tips//7.351</id>
<created>2003-11-09T18:23:16Z</created>
<summary type="text/plain">Hack to show more recent items on the Editing Menu.</summary>
<author>
<name>girlie</name>
<url>http://www.thegirliematters.com/</url>
<email>girlie@thegirliematters.com</email>
</author>
<dc:subject>hacks</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.thegirliematters.com/tips/">
<![CDATA[<p>By default, the Editing Menu for your blog shows the most recent entries, comments, and trackback pings (5 of each). Here's how to increase that number.</p>]]>
<![CDATA[<p>The code is in lib/MT/App/CMS.pm, and all line numbers are based on v2.661.</p>

<p><b>Entries, lines 233-236:</b></p>

<div class="codesample">    my $iter = MT::Entry->load_iter({ blog_id => $blog_id },<br />
        { 'sort' => 'created_on',<br />
          direction => 'descend',<br />
          limit => <span class="codeoomph">5</span> });
</div>

<p><b>Comments, lines 254-257:</b></p>

<div class="codesample">    $iter = MT::Comment->load_iter({ blog_id => $blog_id },<br />
        { 'sort' => 'created_on',<br />
          direction => 'descend',<br />
          limit => <span class="codeoomph">5</span> });
</div>

<p><b>Pings, lines 272-275:</b></p>

<div class="codesample">    $iter = MT::TBPing->load_iter({ blog_id => $blog_id },<br />
        { 'sort' => 'created_on',<br />
          direction => 'descend',<br />
          limit => <span class="codeoomph">5</span> });
</div>

<p>Change <span class="codeoomph">5</span> to the number you want to display.</p>]]>
</content>
</entry>
<entry>
<title>how to work with templates when making changes</title>
<link rel="alternate" type="text/html" href="http://www.thegirliematters.com/tips/archives/0311/how_to_work_with_templates_when_making_changes.php" />
<modified>2005-08-21T11:24:57Z</modified>
<issued>2003-11-09T17:57:28Z</issued>
<id>tag:www.thegirliematters.com,2003:/tips//7.350</id>
<created>2003-11-09T17:57:28Z</created>
<summary type="text/plain">Using &quot;link this template to a file&quot; to test changes to your templates.</summary>
<author>
<name>girlie</name>
<url>http://www.thegirliematters.com/</url>
<email>girlie@thegirliematters.com</email>
</author>
<dc:subject>tips</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.thegirliematters.com/tips/">
<![CDATA[<p>Just something I posted on the MT Support Forum that I thought I'd put here as well, regarding how I use <code>link this template to a file</code> when making changes to my templates that I may not want to keep.</p>]]>
<![CDATA[<p>I have a templates folder in each of my blog directories. I use the <code>Link this template to a file</code> field to save a copy of every template. For example, my Main Index template is linked to a file named <i>templates/mainindex.tmpl</i>.</p>

<p>When I want to make changes to a template that I'm not sure I want to keep, I modify the linked filename by adding a number to the name (<i>templates/mainindex2.tmpl</i>) and press <code>SAVE</code>.</p>

<p>If I decide I <b>don't</b> like the changes, I <i>delete everything in the template body window</i>, modify the linked file name back to the original (i.e., remove the number) and press <code>SAVE</code> again. The original template then appears in the body window, and I'm back to where I started.</p>

<p>If I decide I <b>do</b> like the changes, I just modify the linked file name back to the original and press <code>SAVE</code> to copy over the original linked file, and now my changes have been permanently retained.</p>

<p>Every now and then, I FTP to my site and remove any of the testing templates by deleting those with numbers.</p>

<p><b>Related Links:</b></p>

<p>&#8226; <a href="http://www.thegirliematters.com/tips/archives/0207/back_up_templates_with_link_this_template.php">back up templates with &quot;link this template&quot;</a><br />
&#8226; <a href="http://www.thegirliematters.com/tips/archives/0301/link_this_template_to_a_file.php">link this template to a file</a></p>]]>
</content>
</entry>

</feed>