<?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>2004-04-05T13:48:41Z</modified>
<tagline>tips and tricks</tagline>
<id>tag:www.thegirliematters.com,2004:/tips//8</id>
<generator url="http://www.movabletype.org/" version="2.661">Movable Type</generator>
<copyright>Copyright (c) 2004, girlie</copyright>
<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>2004-04-05T13:48:41Z</modified>
<issued>2004-04-05T13:48:41Z</issued>
<id>tag:www.thegirliematters.com,2004:/tips//8.898</id>
<created>2004-04-05T13: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>mt 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>2004-04-04T08:01:07Z</modified>
<issued>2004-04-04T08:01:07Z</issued>
<id>tag:www.thegirliematters.com,2004:/tips//8.895</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>2004-01-22T03:01:24Z</modified>
<issued>2004-01-22T03:01:24Z</issued>
<id>tag:www.thegirliematters.com,2004:/tips//8.865</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>2004-01-17T01:32:44Z</modified>
<issued>2004-01-17T01:32:44Z</issued>
<id>tag:www.thegirliematters.com,2004:/tips//8.862</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>mt 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>2004-01-04T21:41:32Z</modified>
<issued>2004-01-04T21:41:32Z</issued>
<id>tag:www.thegirliematters.com,2004:/tips//8.851</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>mt 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.<br />
</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>2003-11-24T01:32:24Z</modified>
<issued>2003-11-24T01:32:24Z</issued>
<id>tag:www.thegirliematters.com,2003:/tips//8.747</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>mt 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>2003-11-23T15:48:53Z</modified>
<issued>2003-11-23T15:48:53Z</issued>
<id>tag:www.thegirliematters.com,2003:/tips//8.746</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>mt 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>2003-11-16T15:52:36Z</modified>
<issued>2003-11-16T15:52:36Z</issued>
<id>tag:www.thegirliematters.com,2003:/tips//8.740</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>mt 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>2003-11-09T18:23:16Z</modified>
<issued>2003-11-09T18:23:16Z</issued>
<id>tag:www.thegirliematters.com,2003:/tips//8.722</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>mt 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>2003-11-09T17:57:28Z</modified>
<issued>2003-11-09T17:57:28Z</issued>
<id>tag:www.thegirliematters.com,2003:/tips//8.720</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>mt 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.<br />
</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>
<entry>
<title>font switcher</title>
<link rel="alternate" type="text/html" href="http://www.thegirliematters.com/tips/archives/0311/font_switcher.php" />
<modified>2003-11-01T17:12:40Z</modified>
<issued>2003-11-01T17:12:40Z</issued>
<id>tag:www.thegirliematters.com,2003:/tips//8.707</id>
<created>2003-11-01T17:12:40Z</created>
<summary type="text/plain">I offer readers the option to increase the font size on my pages.</summary>
<author>
<name>girlie</name>
<url>http://www.thegirliematters.com</url>
<email>girlie@thegirliematters.com</email>
</author>
<dc:subject>usability</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.thegirliematters.com/tips/">
<![CDATA[<p>I've implemented a rather rudimentary (to me, anyway) font switcher for <a href="http://www.thegirliematters.com/tips/archives/0210/recent_songs_on_winamp.php#001210" title="Bob's comment">those who find my teeny font hard on the eyes</a>. It's based on <a href="http://www.alistapart.com/articles/alternate/" title="Alternative Style: Working with Alternate Stylesheets">this article from A List Apart</a>, and you can find the options down on the bottom of the sidebar at left.</p>

<p>I split my current stylesheet down into four new ones:</p><ul><li><i>styles-all.css</i> - those that apply everywhere (i.e., are not font-size specific)</li><li><i>styles-pref.css</i> - the default font sizes</li><li><i>styles-medium.css</i> - 2px greater than the default font sizes</li><li><i>styles-large.css</i> - 4px greater than the default font sizes</li></ul><p>I haven't the patience for full-scale skinning of my site, so this is as close to fancy as it's going to get around here. </p>]]>

</content>
</entry>
<entry>
<title>email not required for comments</title>
<link rel="alternate" type="text/html" href="http://www.thegirliematters.com/tips/archives/0310/email_not_required_for_comments.php" />
<modified>2003-10-05T01:25:18Z</modified>
<issued>2003-10-05T01:25:18Z</issued>
<id>tag:www.thegirliematters.com,2003:/tips//8.690</id>
<created>2003-10-05T01:25:18Z</created>
<summary type="text/plain">A mini-hack to permit users to post comments without providing an email address.</summary>
<author>
<name>girlie</name>
<url>http://www.thegirliematters.com</url>
<email>girlie@thegirliematters.com</email>
</author>
<dc:subject>mt hacks</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.thegirliematters.com/tips/">
<![CDATA[<p>Here's some code I'd noted from <a href="http://www.movabletype.org/support/index.php?act=ST&amp;f=14&amp;t=4821">a forum post by Ben Trott quite a while back</a> - it allows comments to be posted without an email address required. I've slightly updated the change for the latest version of the code.</p>]]>
<![CDATA[<p>Open up lib/MT/App/Comments.pm (save a backup first!) and look for this code (currently at lines 70-73 in v2.64):</p>

<div class="codesample">if (!$blog-&gt;allow_anon_comments &amp;&amp;<br />
    (!$q-&gt;param('author') || !$q-&gt;param('email'))) {<br />
    return $app-&gt;handle_error($app-&gt;translate(<br />
        &quot;Name and email address are required.&quot;));
</div>

<p>and replace with:</p>

<div class="codesample">if (!$blog-&gt;allow_anon_comments &amp;&amp; !$q-&gt;param('author')) {<br />
    return $app-&gt;handle_error($app-&gt;translate(<br />
        &quot;Name is required.&quot;));<br />
</div>

<p>Save and upload the new version of the file to your server in ASCII mode.</p>

<p>Note that I've not actually tested the code myself - I just wanted to document it for reference by others who might be interested in doing this.</p>]]>
</content>
</entry>
<entry>
<title>lastn comments from one category</title>
<link rel="alternate" type="text/html" href="http://www.thegirliematters.com/tips/archives/0309/lastn_comments_from_one_category.php" />
<modified>2003-09-20T17:15:50Z</modified>
<issued>2003-09-20T17:15:50Z</issued>
<id>tag:www.thegirliematters.com,2003:/tips//8.677</id>
<created>2003-09-20T17:15:50Z</created>
<summary type="text/plain">Using PHP and MySQL to show the lastn comments on entries from one category.</summary>
<author>
<name>girlie</name>
<url>http://www.thegirliematters.com</url>
<email>girlie@thegirliematters.com</email>
</author>
<dc:subject>mt tricks</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.thegirliematters.com/tips/">
<![CDATA[<p>I was playing around with this a while back and figured I'd better blog it before I lost track of it again.</p>

<p>This MySQL/PHP code gives me the last 5 comments on entries in one particular category. The display format is identical to the Recent Comments listing in my sidebar.</p>

<p>Note that the permalinks to the entries are customized to match my Archive File Templates, so this probably isn't something you can just cut-and-paste to use for yourself, but it gives some idea of how permalinks can be constructed.</p>]]>
<![CDATA[<p><b>Here's the code:</b></p>

<div class="codesample">&lt;? include (&quot;<span class="codeoomph">/path/to/connect.php</span>&quot;);<br />
<br />
$blogurl=&quot;<span class="codeoomph">http://www.thegirliematters.com/tips/archives</span>&quot;;<br />
<br />
function dirify ($s) {<br />
 $s = strtolower($s);<br />
 $patterns = array('/&lt;[\/\!]*?[^&lt;&gt;]*?&gt;/s', '/&amp;[^;\s]+;/',
                   '/[^\w\s]/', '/ /');<br />
 $replace = array('', '', '', '_');<br />
 $s = preg_replace($patterns, $replace, $s);<br />
 return $s;<br />
}<br />
<br />
$comments = mysql_query(&quot;SELECT comment_url, comment_author, SUBSTRING_INDEX(comment_text, ' ', 10) AS comment, comment_entry_id, entry_title, date_format(entry_created_on, '%y%m') AS archive_path FROM mt_comment, mt_entry, mt_placement WHERE (comment_entry_id = placement_entry_id) AND (placement_entry_id = entry_id) AND (placement_category_id = <span class="codeoomph">54</span>) ORDER BY comment_created_on DESC LIMIT <span class="codeoomph">5</span>&quot;);<br />
<br />
while($row = mysql_fetch_array($comments)) {<br />
$url = $row['comment_url'];<br />
$author = $row['comment_author'];<br />
$text = strip_tags($row['comment']);<br />
$title = dirify ($row['entry_title']);<br />
$titlenodir = $row['entry_title'];<br />
$archivepath = $row['archive_path'];<br />
echo &quot;&amp;#8226; &lt;a href=\&quot;$url\&quot;&gt;$author&lt;/a&gt;: $text [&lt;a href=\&quot;$blogurl/$archivepath/$title.php\&quot; title=\&quot;$titlenodir\&quot;&gt;entry&lt;/a&gt;]&lt;br /&gt;\n&quot;;<br />
}<br />
?&gt;
</div>

<p>Items in <span class="codeoomph">color</span> represent variables to be changed (and of course, there's the whole permalink issue in the last <i>echo</i> statement).</p>

<p>FYI, here's the Archive File Template I use for my Individual Archives:</p>

<div class="codesample">&lt;MTEntryDate format=&quot;%y%m&quot;&gt;/&lt;MTEntryTitle dirify=&quot;1&quot;&gt;.php
</div>

<p>which gives me filenames as <i>YYMM/entry_title.php</i>, and that is what the code is written to mimic.</p>

<p><b>Related Entries:</b></p>

<p>&#8226; <a href="http://www.thegirliematters.com/tips/archives/0401/category_specific_recent_comments_listing.php">category specific recent comments listing</a></p>]]>
</content>
</entry>
<entry>
<title>configuration listing with php and mysql</title>
<link rel="alternate" type="text/html" href="http://www.thegirliematters.com/tips/archives/0309/configuration_listing_with_php_and_mysql.php" />
<modified>2003-09-07T20:33:28Z</modified>
<issued>2003-09-07T20:33:28Z</issued>
<id>tag:www.thegirliematters.com,2003:/tips//8.674</id>
<created>2003-09-07T20:33:28Z</created>
<summary type="text/plain">Generate a single page showing all of your configuration settings.</summary>
<author>
<name>girlie</name>
<url>http://www.thegirliematters.com</url>
<email>girlie@thegirliematters.com</email>
</author>
<dc:subject>mt tricks</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.thegirliematters.com/tips/">
<![CDATA[<p>I was really excited when Kristine presented us with the <a href="http://www.virtualvenus.org/archives/0305/multiple_blog_suite.php" title="Virtual Venus entry">Multiple Blog Suite</a> - but for some reason, my browser (IE5.5) didn't seem to get along with the Suite files too well.</p>

<p>Since I already have a means of <a href="http://www.thegirliematters.com/tips/archives/0207/back_up_templates_with_link_this_template.php" title="earlier entry">backing up my templates</a>, I wasn't too distressed about that. But I <b>really</b> wanted to get my hands on the Configuration piece of the Suite.</p>

<p>So I stole K's code, and used it as the foundation for my own Configuration Listing, adding some new option details not included in the original. </p>]]>
<![CDATA[<p>First off, if you're not using PHP and MySQL, then I'm sorry, this isn't going to be anything you can use. Maybe one day, I'll learn Perl, but for now, these are the two subjects I'm brain-deep in trying to figure out.</p>

<p>I've <a href="http://www.thegirliematters.com/tips/downloads/config.zip" title="zip file 9KB">zipped the files</a> and put most of the instructions there, but I'll give you a little overview.</p>

<p>Files included:</p>

<ul><li>configreadme.txt</li><li>configscript.php</li><li>configscriptwrite.php</li><li>connect.php</li><li>nav.inc</li><li>styles.css</li></ul>

<p>There are two versions of the script itself: <i>configscript.php</i> and <i>configscriptwrite.php</i>.</p>

<p>The first gives you a display page only, which you can save locally using <b>File > Save As</b> from your browser. The second gives you the display page <b>and</b> writes the contents to a .txt file on your server as a backup.</p>

<p>If you have multiple blogs, you can create multiple copies of the script file, and use <i>nav.inc</i> to view the listings for each of them.</p>

<p>And <i>styles.css</i> is provided for customization if you're not fond of the traditional Girlie colors.</p>

<p>Because I'm a stickler for managing everything I can in MT, each of the script files for my blogs was created as a Template Module in my newly created Backup blog (more on what I use this blog for can be found at <a href="http://www.virtualvenus.org/archives/0309/create_an_export_blog.php" title="Virtual Venus entry">Virtual Venus</a>).</p>

<p>Finally, there's a <a href="http://www.thegirliematters.com/tips/demos/configdemo.php" title="demo link">sample output page</a> for your viewing pleasure.</p>

<p>It may not be useful to anyone other than me, but I really enjoyed the challenge of learning to do this. And there's really no point to learning if you don't share the final results. :smile:</p>]]>
</content>
</entry>
<entry>
<title>category count excluding one category</title>
<link rel="alternate" type="text/html" href="http://www.thegirliematters.com/tips/archives/0306/category_count_excluding_one_category.php" />
<modified>2003-06-16T01:25:43Z</modified>
<issued>2003-06-16T01:25:43Z</issued>
<id>tag:www.thegirliematters.com,2003:/tips//8.630</id>
<created>2003-06-16T01:25:43Z</created>
<summary type="text/plain">Display a total count of all entries in your blog excluding those in one category.</summary>
<author>
<name>girlie</name>
<url>http://www.thegirliematters.com</url>
<email>girlie@thegirliematters.com</email>
</author>
<dc:subject>mt tricks</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.thegirliematters.com/tips/">
<![CDATA[<p><a href="http://kadyellebee.com" title="visit Kristine's site">Kristine</a> whipped up some PHP using the <a href="http://mt-plugins.org/archives/entry/filtercategories.php" title="FilterCategories at MT Plugins">FilterCategories plugin</a> to give you a total count of all entries in your blog <i>less</i> those in one particular category.</p>

<div class="codesample">&lt;?php<br />
$all=&quot;&lt;$MTBlogEntryCount$&gt;&quot;;<br />
$not=&quot;&lt;MTCategories&gt;&lt;MTFilterCategories include=&quot;<span class="codeoomph">general</span>&quot;&gt;<br />
&lt;$MTCategoryCount$&gt;<br />
&lt;/MTFilterCategories&gt;&lt;/MTCategories&gt;&quot;;<br />
echo $all-$not;<br />
?&gt;
</div>

<p>Replace <span class="codeoomph">general</span> with the name of the category you want to exclude.</p>

<p>Found in <a href="http://www.movabletype.org/support/index.php?act=ST&amp;f=14&amp;t=21998" title="thread on the MT forum">this MT support forum thread</a>.</p>]]>

</content>
</entry>

</feed>
