mini tips

search results in a new window
November 09, 2003

How to open search results in a new window:

<form method="get" action="<$MTCGIPath$><$MTSearchScript$>" target="_blank">

include extended entry in notifications
November 09, 2003

Find this code in lib/MT/App/CMS.pm (currently at line 2585 in v2.64):

$body .= Text::Wrap::wrap('', '', $entry->text) . "\n";

and change it to:

$body .= Text::Wrap::wrap('', '', $entry->text . "\n\n" . $entry->text_more) . "\n";

finding the path with PHP
November 09, 2003

Upload as a .php file to your directory and run with your browser:

<? print $PATH_TRANSLATED; ?>

entry title as tooltip in calendar
November 09, 2003

Have the title of the most recent entry display when you hover over the link in the calendar.

<MTCalendarIfEntries><MTEntries lastn="1"><a href="<$MTEntryPermalink$>" title="<MTEntryTitle encode_html="1">"><$MTCalendarDay$></a></MTEntries>
</MTCalendarIfEntries>

mailto link using entry title as subject
November 09, 2003

Code snippet to create an author mailto link using the entry title as the subject:

<a href="mailto:<$MTEntryAuthorEmail spam_protect="1"$>?subject=<MTEntryTitle>"><MTEntryAuthor></a>

cc: comment notifications to a second email address
October 04, 2003

Find this code in lib/MT/App/Comments.pm (currently at line 132 in v2.64):

my %head = ( To => $author->email,

and add this line right after it:

Cc => 'email@domain.com',

replacing email@domain.com with a valid email address.


number of categories with php
September 20, 2003

Code from Kristine found on the forum:

<?
$count=array(<MTCategories>"<$MTCategoryLabel$>", </MTCategories>);
echo count($count);
?>

php snippet - padded entry id
September 20, 2003

Just a little bit of handy code.

$padded_entry_id = str_pad($entry_id, 6, "0", STR_PAD_LEFT);

format hour or day without padding
August 10, 2003

Date with no day padding:

<MTEntryDate format="%B"> <MTEntryDate format="%e" sprintf="%-u">, <MTEntryDate format="%Y">

Time with no hour padding:

<MTEntryDate format="%k" sprintf="%-u">:<MTEntryDate format="%M %p">

author icons
June 16, 2003

Create icons for each author by naming your graphics with the author name, dirified, then use this code:

<img src="<$MTEntryAuthor dirify="1"$>.gif" alt="<$MTEntryAuthor$>" />

Credit: Kristine