<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0" 
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
  xmlns:admin="http://webns.net/mvcb/"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">

<channel>
<title>My Messy Workbench: Gems</title>
<link>http://www.synaptic.bc.ca/MyMessyWorkbench/archives/gems.xml</link>
<description>A disorganised shambles
obscuring the occasional gem.</description>
<dc:language>en-us</dc:language>
<dc:creator>eBlog@synaptic.bc.ca</dc:creator>
<dc:date>2004-06-21T00:36:59-08:00</dc:date>
<admin:generatorAgent rdf:resource="http://www.movabletype.org/?v=2.661" />
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>

<item>
<title>Amazon Products Feed: Display the Most Popular Items</title>
<link>http://www.synaptic.bc.ca/MyMessyWorkbench/archives/2004/06/amazon_products_feed_display_the_most_popular_items.php</link>
<description>About apf_pop.cgi
MrRat&apos;s amazon_product_feeds.cgi script (APF) is a marvellously useful script. It&apos;s robust and nimble interface provides rich opportunities for exploitation. Here&apos;s a script most webmasters of APF sites will find useful.

The apf_pop.cgi script searches your website&apos;s access log for specific kinds of APF calls that indicate a user clilcking on an item and grabs the Amazon ASIN&apos;s from them. The ASINs are counted and sorted, then one or more documents are constructed to display them. 

In addition to the data formatting templates available through APF, apf_pop adds an additional templating layer with its own variables. The type of document apf_pop can generate is virtually unlimited: HTML, SHTML, PHP, CGI, even output an APF template, if you like. As this implies, through apf_pop you can display data generated by APF in either dynamic or static documents. 
&lt;br /&gt;&lt;br /&gt;<![CDATA[          Templates

First, things first: design an apf_pop template. It can be based on any type of 
          document. Several template variables are available to help. We'll begin 
          with the core variables. 
          ASIN Data
There are two options for determining how ASIN data is to be placed in your files. 
          Only one or the other of these variables can appear in a template file. 
          %%Popular_ASIN%%
In the output file, this variable is replaced by a comma-delimited list of ASINs suitable for an APF AsinSearch. Examples:

            &lt;!--apf &amp;apf_include=amazon_products_feed.cgi?
			&nbsp;&nbsp;&nbsp;&nbsp;search_type=AsinSearch&item_id=%%Popular_ASIN%%!--&gt;
             &lt;!--#include virtual="/cgi-bin/amazon_products_feed.cgi?&nbsp;&nbsp;&nbsp;&nbsp;search_type=AsinSearch&item_id=%%Popular_ASIN%%" 
              --&gt;
             &lt;a href="/cgi-bin/amazon_products_feed.cgi?
			&nbsp;&nbsp;&nbsp;&nbsp;search_type=AsinSearch&item_id=%%Popular_ASIN%%&gt;The 
              Top 10!&lt;/a&gt; 
          
The first example is, of course, useful for APF templates. It will expand to a formatted list each time the template is parsed. The second can be placed in any SSI parsed file. The list of Amazon items will be generated each time the file is accessed. The third is a simple link you can place anywhere.
%%Popular_HTML%%
When apf_pop encounters this template variable it calls APF,  passing it the ASINs. APF returns data formatted by the APF template set you specify in apf_pop. Finally, apf_pop parses the data, performing some error-checking and data reformatting, before writing the refined formatted data to the output file. PHEW!This one requires a bit of tricky configuration to setup, but %%Popular_HTML%% offers some distinct advantages over %%Popular_ASIN%%.
Static Pages: Unless your APF templates are doing something unusual, the resulting formatted output is suitable for static HTML pages. This will reduce server overhead, bandwidth and user frustration. Yay!
Heavy data: You can use a 'heavy' version of APF rather than the default 'lite' version to generate these static pages. If your site has  heavy traffic in DVDs and Videos, your users may appreciate the Director and Starring links apf_pop provides via APF 'heavy' calls.
Error checking: apf_pop pulls those annoying "There are no exact matches" and "Invalid Asin" messages right out of the data stream and discards them so your visitors never see them.
There is a niggly drawback to %%Popular_HTML%%
Multiple APF scripts: Whether you elect to create a 'heavy' APF for apf_pop's use or not, you'll want apf_pop to call a copy of the  APF script with a different name than the one called when users click on your site's links. This is due to the way apf_pop gathers ASINs from the log file. I'll explain why in some detail later on. The distribution zip contains some tools for diminishing the burden.

The remaining template variables can be used in both the ASIN and HTML context.

%%see_prev_popular%% and %%see_next_popular%%
These will place Next and Back buttons for navigating between pages created by the call to apf_pop.
%%Popular_Page_Count%%
This is replaced by a "Page 3 of 4" message.

More template variables are coming in future versions of this script.

Configuring apf_pop for %%Popular_ASIN%%

We'll begin with the simpler case, configuring apf_pop for a %%Popular_ASIN%% template. There are several variables which must be defined in the script.

General script setup
$max_pages = 20
$items_per_page = 5;

Pretty straightforward. In this example apf_pop will create up to 20 pages listing 5 items per page.

$Popular_var_type = "ASIN";

Tells apf_pop to look for %%Popular_ASIN%% in the template file and replace it with a string of comma delimited ASINs in the output files.

logfile parsing
;
$logfile =  "/home/username/logs/access.log"
Specifies is the log file apf_pop will scan for ASINs. Include the full server directory path as necessary so the script knows where to find it.

$logfile_get_string = "\"get /cgi-bin/Amazon/amazon_products_feed.cgi"

This character string identifies the lines in your logfile representing APF activity. apf_pop will parse these lines for AsinSearch. It's important that this string ignores the log entry's referrer data, so that only user activity to view an ASIN is counted, and not all the times the user clicks another link on that page. $logfile_get_string can be a regular expression; apf_pop will give the string a once-over to assure special characters have been escaped properly.

Logfiles can be quite large so keep this string short to minimise the amount of processing apf_pop must do. The format of the string in the example above will work fine in most instances. "\"get" identifies the opening of a page and is followed by the URL of the page to be opened. Folks on unix servers can test this out using grep. EG:


grep "\"get /your/path/amazon_products_feed.cgi" access.log &gt; apf.log


The file "apf.log" will contain the results. It's likely to be big, so don't forget to delete it.

apf_pop template setup
$template_file = "/home/bv126070/public_html/cgi-bin/Amazon/popular_list.template.html";

Identifies the template used by apf_pop to generate the output pages. Include directory path as necessary.

$nav_target = "_top";
Specifies the link "target" for links generated  for %%see_prev_popular%% and %%see_prev_popular%%,  $nav_target = "_self" is useful for popular pages placed within FRAMESETS or IFRAMES, otherwise, "_top" works well. If you specify an empty string, then the links will have no target.



apf_pop scans the access log for entries containing an APF AsinSearch. If the item_id field contains only one ASIN, then apf_pop counts it as a click and grabs the ASIN.]]></description>
<guid isPermaLink="false">294@http://www.synaptic.bc.ca/MyMessyWorkbench/</guid>
<dc:subject>Instruction Manual</dc:subject>
<dc:date>2004-06-21T00:36:59-08:00</dc:date>
</item>
<item>
<title>IFRAME and Amazon Product Feed:</title>
<link>http://www.synaptic.bc.ca/MyMessyWorkbench/archives/2004/06/iframe_and_amazon_product_feed.php</link>
<description><![CDATA[How to display inline searches in your templates and pagesA Newbie Tutorial

On my HTML pages I figured out how to use SSI to display the results of amazon_product_feed searches on my web pages. However, Neither the SSI or PHP methods described in the documentation will work if placed within the templates.  I've got this great sidebar in my page design but very few of the useful Amazon Product Feed variables are available at the page template level. What to do?

There are two HTML options &lt;OBJECT&gt; and &lt;IFRAME&gt;.  These are fairly well supported on the more popular browsers, though OBJECT is the only one of the two specified in the HTML 4.0 standards. Nonetheless, I went with IFRAME for some of its more useful features.
]]>&lt;br /&gt;&lt;br /&gt;<![CDATA[
Two HTML options &lt;OBJECT&gt; and &lt;IFRAME&gt;.  These are fairly well supported on the more popular browsers, though OBJECT is the only one of the two specified in the HTML 4.0 standards. Nonetheless, I went with IFRAME for some of its more useful features.

It took some immersion in HTML references and some code from additional sources to get all this working, but it's not rocket science. An IFRAME is just a window layered on top of your main window. You can display stuff in it in much the same way you would the main browser. We're going to make it as transparent and flexible as possible. It's quite amazing the results a couple lines of code can produce!  Well, there is a bit more to it than that...

Setting Up the Frame


&lt;iframe name="sidebar" id="sidebar" align="top" allowtransparency="true" 
    marginwidth="4" width="100%" height="750" 
    scrolling="auto" frameborder="0" 
    src="/cgi-bin/Amazon/amazon_heavy_products_feed.cgi?
    mode=blended&search_type=SimilaritySearch&input_string=%%Asin%%
    &templates=4&link_templates=1&max_results=6&link_max_results=10"&gt;
    
          Sorry, your browser does not support IFRAMEs

&lt;/iframe&gt;


So we have a child frame appearing in the parent window with the following configuration

An IFRAME named "sidebar" (we'll be using that later),
that will hopefully force itself to display at the top of the sidebar 
it's transparent so whatever colour our sidebar is will show through
as wide as the parent sidebar (less 4 pixel margins on each side)
will automatically put up scroll bars if there's more data than fits in the frame.
won't have a border because we already have one in the parent sidebar.
browsers which don't support IFRAMES will display the message instead.


Nifty. Now inside that IFRAME is a call to the APF script. This call will perform a similarity search on the current value for %%Asin%%. It's calling a special 'heavy' version of the script which I've lightly hacked in order to get the "heavy" data from AWS, in order to display %%Director%% and %%Starring%% information when available. There's more to this call, but we'll get back to that.

For now, let's finish off the IFRAME implementation.

Resizable IFRAMEs

We've configured our IFRAME to be 750 pixels in height. That's fine when you know how much data the search will return, but we don't. In order to make it resizable, we have to get the IFRAME window and its parent window to have a conversation. "Hey Dad!" "Yes, son?" "I need to be T H I S  B I G !!!" Except they're going to talk in javascript. There's a simple example of this here found on this page. I'd save you all the digging, but the code's Terms of Use prevent me from redistributing it. Instead, I'll tell you what you need to do.

First, view the source code of this page and find the line 


&lt;script type="text/javascript"&gt;


Copy that line and everything following it until you get to 


&lt;/head&gt;


and paste the whole block into your parent page somewhere inside the the &lt;head&gt; container.


]]></description>
<guid isPermaLink="false">289@http://www.synaptic.bc.ca/MyMessyWorkbench/</guid>
<dc:subject>Gems</dc:subject>
<dc:date>2004-06-04T21:46:25-08:00</dc:date>
</item>
<item>
<title>New Topic notification</title>
<link>http://www.synaptic.bc.ca/MyMessyWorkbench/archives/2004/01/new_topic_notification.php</link>
<description>
There&apos;s a phpBB hack to add Forum-wide email notification to phpBB boards. It&apos;s a good hack, except that it generates notification emails for all replies to all forum topics. This is a bit too much notification.

Following is a method for reducing forum-level notification so that they are only sent when a new topic is created.
&lt;br /&gt;&lt;br /&gt;<![CDATA[
First, fully install and test the phpBB Forum Notification hack.
Then, re-open the file include/functions_post.php
 Find 


$sql = "SELECT u.user_id, u.username, u.user_email, u.user_lang, t.topic_title, f.forum_name 
	FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . FORUMS_WATCH_TABLE . " fw, " . FORUMS_TABLE . " f 
	WHERE fw.forum_id = $forum_id 
		AND fw.user_id NOT IN (" . $already_mailed . $userdata['user_id'] . ", " . ANONYMOUS . $user_id_sql . " ) 
		AND t.topic_id = $topic_id 
		AND f.forum_id = $forum_id 
		AND f.forum_notify = '1' 
		AND u.user_id = fw.user_id";
if ( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, "", "", __LINE__, __FILE__, $sql);
}

$script_name = preg_replace("/^\/?(.*?)\/?$/", "\\1", trim($board_config['script_path']));
$script_name_forum = ( $script_name != '' ) ? $script_name . '/viewforum.'.$phpEx : 'viewforum.'.$phpEx;
$script_name = ( $script_name != '' ) ? $script_name . '/viewtopic.'.$phpEx : 'viewtopic.'.$phpEx;

$temp_is_auth = array();

if ( $row = $db->sql_fetchrow($result) )
{
	$topic_title = preg_replace($orig_word, $replacement_word, unprepare_message($row['topic_title']));
	$post_text = preg_replace($orig_word, $replacement_word, unprepare_message($post_data['message']));

	do
	{
		$temp_userdata = get_userdata($row['user_id']);
		$temp_is_auth = auth(AUTH_ALL, $forum_id, $temp_userdata, -1);
	
	// another security check (i.e. the forum might have become private and 
	// there are still users who have notification activated)
		if( $temp_is_auth['auth_read'] &amp;&amp; $temp_is_auth['auth_view'] )
		{
			if ( $row['user_email'] != "" )
			{
				$emailer->use_template("forum_notify", $row['user_lang']);
				$emailer->email_address($row['user_email']);
				$emailer->set_subject();//$lang['Topic_reply_notification']
				$emailer->extra_headers($email_headers);

				$emailer->assign_vars(array(
					"EMAIL_SIG" => str_replace("", "\n", "-- \n" . $board_config['board_email_sig']),
					"USERNAME" => $row['username'],
					"SITENAME" => $board_config['sitename'],
					"TOPIC_TITLE" => $topic_title, 
					"POST_TEXT" => $post_text, 
					"POSTERNAME" => $post_data['username'], 
					"U_TOPIC" => $server_protocol . $server_name . $server_port . $script_name . "?" . POST_POST_URL . "=$post_id#$post_id",
					"FORUM_NAME" => $row['forum_name'], 
					"U_STOP_WATCHING_FORUM" => $server_protocol . $server_name . $server_port . $script_name_forum . "?" . POST_FORUM_URL . "=$forum_id&amp;unwatch=forum")
				);

				$emailer->send();
				$emailer->reset();

			}
		}
	}
	while ( $row = $db->sql_fetchrow($result) );
}



Delete this code block (or comment it out). Careful! There's a similar block above this which sends the default phpBB topic-reply notification and you'll want to keep that.



Save the file. Now your forums should be enabled to notify for new topics in watched forums as well as new replies in watched topics.

p.
/" target="_blank">" hspace="4" align="right" border="0">Presently listening to:Kashmir - Led Zeppelin - Physical Graffitti (08:33)&keyword=&mode=music">/" target="_blank">&nbsp;

]]></description>
<guid isPermaLink="false">160@http://www.synaptic.bc.ca/MyMessyWorkbench/</guid>
<dc:subject>Notebook</dc:subject>
<dc:date>2004-01-18T11:07:57-08:00</dc:date>
</item>
<item>
<title>Add Quick Reply phpBB hack to MT.</title>
<link>http://www.synaptic.bc.ca/MyMessyWorkbench/archives/2004/01/add_quick_reply_phpbb_hack_to_mt.php</link>
<description>http://www.phpbbhacks.com/viewhack.php?id=540

I&apos;ve already got this simple but elegant hack working in phpBB.  Now it&apos;s just a matter of porting it to my MT installation.

[EDIT]

Done! Want to know how to do it yourself?  Read on! (Note: This MT add-on assumes you&apos;ve already installed the fluffyblog Using phpBB as your MovableType comment engine in 23847392 easy steps tutorial to your MovableType installation.
&lt;br /&gt;&lt;br /&gt;<![CDATA[Once you've installed the above hack to your phpBB installation, it's a fairly simple matter to install it in your MT archives.

First, you need to have fluffyblog's display code installed, so download this php include file to your phpBB root directory.
Now open the file, and find the lines:


echo &quot;&lt;div class=\&quot;comments-footer\&quot;&gt;&quot;;
if ($display_userdata &amp;&amp; $display_userdata['session_logged_in'])


Insert the following code above the lines.


//
// Quick Reply Mod
//
if ( $can_watch_topic &amp;&amp; $is_watching_topic )
{
	$notify = 1;
}
else
{
	$notify = $display_userdata['user_notify'];
}
$quick_reply_form = &quot;
&lt;script language='JavaScript' type='text/javascript'&gt;
function checkForm() {
formErrors = false;
document.post.message.value = '';
if (document.post.input.value.length &lt; 2) {
	formErrors = 'Can't post an empty comment!';
}
if (formErrors) {
	alert(formErrors);
	return false;
} else {
	if (document.post.quick_quote.checked) {
	document.post.message.value = document.post.last_msg.value;
	}
	document.post.message.value += document.post.input.value;
	return true;
	}
}
&lt;/script&gt;&quot;;


if ($display_userdata['session_logged_in'])
{
	$quick_reply_form .= &quot;&lt;form action='&quot; . append_sid($phpbb_root_path . 
	&quot;posting.php&quot;) . &quot;' method='post' name='post' onsubmit='return 
	checkForm(this)'&gt;
	&lt;span class='genmed'&gt;&lt;b&gt;Comment:&lt;/b&gt;&lt;br /&gt;&quot;;

	$quick_reply_form .= &quot;&lt;textarea name='message' rows='10' cols='50' 
	class='post'&gt;&lt;/textarea&gt;&lt;br /&gt;
	&lt;input type='hidden' name='quick_quote' /&gt; 
	&lt;input type='checkbox' name='attach_sig' checked='checked' /&gt;Attach Signature 
	(signatures can be changed in profile)&lt;br /&gt;
	&lt;input type='hidden' name='mode' value='reply' /&gt;
	&lt;input type='hidden' name='sid' value='&quot; . $display_userdata['session_id'] . &quot;' /&gt;
	&lt;input type='hidden' name='t' value='&quot; . $thread_id . &quot;' /&gt;
	&lt;input type='hidden' name='input' value='OOPS!' /&gt;
	&lt;input type='hidden' name='notify' value='&quot; . $notify . &quot;' /&gt;
	&lt;input type='submit' name='preview' class='liteoption' value='Preview' /&gt;&amp;nbsp;
	&lt;input type='submit' name='post' class='mainoption' value='Submit' /&gt;
	&lt;/span&gt;&lt;/form&gt;&quot;;
}
echo $quick_reply_form;
//
// END Quick Reply Mod
//


Now, in MT, open the archive template you wish to display the quick comment form in and insert the following code at the very top of the template:


&lt;?
	$phpbb_root_path=&quot;../../Contact/&quot;;
	include_once($phpbb_root_path . 'integrate.inc');
	include_once($phpbb_root_path . 'forumfuncs.inc');
	include_once($phpbb_root_path . 'mods/phpbb_fetch_all/common.' . $phpEx);
	include_once($phpbb_root_path . 'mods/phpbb_fetch_all/posts.' . $phpEx);
	# Note that because of this, this must be included before any HTML is output
	  $display_userdata = session_pagestart($user_ip, PAGE_INDEX);
	  init_userprefs($display_userdata);
?&gt;
  &lt;!-- END phpBB comment engine insert --&gt;


Also, place the following code where you want your comments and comment form to appear in your template:


&lt;?
	$thread_id = &lt;$MTInclude module=&quot;GetForum&quot;$&gt;;
	ThreadDisplay($thread_id);
?&gt;


Don't forget to remove the old phpBB comments display from that template! Otherwise, you'll see the phpBB comments displayed twice!


That should do it.  Save, Rebuild, Etc. and, so long as you're currently logged in to phpBB, you should see a quick comment form.  

p.]]></description>
<guid isPermaLink="false">154@http://www.synaptic.bc.ca/MyMessyWorkbench/</guid>
<dc:subject>Too Done List</dc:subject>
<dc:date>2004-01-11T02:28:42-08:00</dc:date>
</item>
<item>
<title>Created a Category Archive Index</title>
<link>http://www.synaptic.bc.ca/MyMessyWorkbench/archives/2003/12/created_a_category_archive_index.php</link>
<description><![CDATA[I created a Category Archive Index template in the Index Templates section. It creates the file http://www.synaptic.bc.ca/NoMadMan/CategoryIndex.html, listing all categories, with their descriptions, and the entries in them. It also uses &lt;a name="..."&gt to create links to anchors within the document, which I use to build a menu bar at the top of the document.  

To do this yourself, create a new index template called CategoryIndex.

Copy the default MasterArchive index template to your new CategoryIndex template.

Insert the code below into CategoryIndex, replacing the &lt;MTArchive&gt; container.


&lt;div align="center"&gt;
&lt;MTCategories glue=" | "&gt;
    &lt;a href="#&lt;$MTCategoryLabel$&gt;"&gt;&lt;$MTCategoryLabel$&gt;&lt;/a&gt;
&lt;/MTCategories&gt;
&lt;/div&gt;
&lt;div&gt;&nbsp;&lt;/div&gt;
&lt;dl&gt;
&lt;MTCategories&gt;
    &lt;dt&gt;&lt;a name="&lt;$MTCategoryLabel$&gt;"&gt;&lt;/a&gt;&lt;a
    href="&lt;$MTCategoryArchiveLink$&gt;"&gt;&lt;h2&gt;&lt;strong&gt;&lt;$MTCategoryLabel$&gt;
    &nbsp;(&lt;$MTCategoryCount$&gt;)&lt;/strong&gt;&lt;/h3&gt;&lt;/a&gt; &lt;/dt&gt;
&lt;dd&gt;&lt;blockquote&gt;&lt;$MTCategoryDescription$&gt;&lt;/blockquote&gt;
    &lt;MTEntries&gt;
        &lt;a href="&lt;$MTEntryLink$&gt;"&gt;&lt;strong&gt;&lt;$MTEntryTitle$&gt;&lt;/strong&gt;&lt;/a&gt;&nbsp;::&nbsp;
        &lt;MTEntryCategories glue=" | "&gt;
        &lt;a href="&lt;$MTCategoryArchiveLink$&gt;"&gt;&lt;em&gt;&lt;$MTCategoryLabel$&gt;
        &lt;/em&gt;&lt;/a&gt; &lt;/MTEntryCategories&gt;&lt;br /&gt;
      &lt;/MTEntries&gt;
    &lt;/dd&gt;
      &lt;br /&gt;&lt;br /&gt;
&lt;/MTCategories&gt;&lt;/div&gt;
&lt;/dl&gt;


When you rebuild, there'll be a new CategoryIndex in your blog root directory. Just add links in your other templates and you're ready to go.

Presently listening to:September Fifteenth - Pat Metheny & Lyle Mays - As Falls Wichita, So Falls Wichita Falls (07:45)/" target="_blank">/" target="_blank">" hspace="4" align="right" border="0">&nbsp;]]>&lt;br /&gt;&lt;br /&gt;</description>
<guid isPermaLink="false">68@http://www.synaptic.bc.ca/MyMessyWorkbench/</guid>
<dc:subject>Too Done List</dc:subject>
<dc:date>2003-12-18T20:37:40-08:00</dc:date>
</item>
<item>
<title>Q: How can I get the category(ies) to display with my entry?</title>
<link>http://www.synaptic.bc.ca/MyMessyWorkbench/archives/2003/12/q_how_can_i_get_the_categoryies_to_display_with_my_entry.php</link>
<description><![CDATA[How'd I get the "Notebook" category link to display on the same line as the entry title? 

This one's really easy. First, take a look @ The MT Wiki MTCategory page.  You'll get the basics there. And while you're there, bookmark the MT Wiki site -- very useful.

Armed with that little tidbit of knowledge, all I did was find MTEntryTitle tag in my index templates. They looked like


            &lt;h3 class=&quot;title&quot;&gt;&lt;$MTEntryTitle$&gt;&lt;/h3&gt;

I wrapped them in two-cell tables, like this. 


&lt;table width=&quot;100% border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;
&lt;tr valign=top&gt;&lt;td&gt;
    &lt;h3 class=&quot;title&quot;&gt;&lt;$MTEntryTitle$&gt;&lt;/h3&gt;
&lt;/td&gt;&lt;td align=right&gt;
    &lt;MTEntryCategories glue=&quot;, &quot;&gt;
        &lt;a href=&quot;&lt;$MTCategoryArchiveLink$&gt;&quot;&gt;&lt;$MTCategoryLabel$&gt;&lt;/a&gt;
    &lt;/MTEntryCategories&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt; 


The title is in the left hand cell and the piece of code from MT Wiki is in the right-hand cell. I set that cell to right justify.

No sweat!

p.
Presently listening to:Letter to Hiro - The Vapours -  New Clear Days - (06:23)/" target="_blank">/" target="_blank">" hspace="4" align="right" border="0">&nbsp;

]]>&lt;br /&gt;&lt;br /&gt;</description>
<guid isPermaLink="false">55@http://www.synaptic.bc.ca/MyMessyWorkbench/</guid>
<dc:subject>Too Done List</dc:subject>
<dc:date>2003-12-15T19:52:45-08:00</dc:date>
</item>
<item>
<title>Presently listening to:</title>
<link>http://www.synaptic.bc.ca/MyMessyWorkbench/archives/2003/12/presently_listening_to.php</link>
<description>This is a tutorial for installing a Windows-only implementation for Moveable Type (MT) bloggers, though Mac users may nonetheless find some useful ideas here, as certainly will enthusiasts for other blogging systems..

If you want to be able to insert Amazon links to whatever&apos;s playing on Windows Media Player or WinAmp into your blog entries, read on. It&apos;s not all that difficult: it does require some trival edits to some of your MT templates, and you&apos;ll have to install a couple plug-ins. If you don&apos;t already use Zempt 0.3 SharpMT 2.0 or w.Bloggar, you&apos;ll need one of these too, if only to generate the required code. &lt;br /&gt;&lt;br /&gt;<![CDATA[
Caveat 1:  if your blog is very big, this will likely slow your site builds considerably.

Caveat 2: you'll need to think of every entry in your blog, past and future, as code after implementing this. Because of that, it may not be appropriate or safe for all blogs

OK, so one of the cool things Zempt 0.3 is able to do is grab the 411 on whatever's playing on your WIndows MediaPlayer (or WinAmp), format it and paste the result to your cursor position in the edit window. Easy enough. And here's Zempt's default result:

[Listening to: Rhiannon - Fleetwood Mac - Rumours (04:11)]

What makes this subtly powerful is that the format is user-definable. Hmmmm.

That's what got me thinking...why not define a format that will apply the MTAmazon plugin to the data and generate something a bit more interesting?  EG: 

/" target="_blank">" hspace="4" align="right" border="0">Presently listening to:Regarding Saturday - Sumack - Now Hear This (03:38)/" target="_blank">&nbsp;
That is, munge the format so it generates the necessary plugin code and plops it into your edit window. Turns out that's easy enough too, but we're getting ahead of ourselves. So, the steps from the beginning.
Install the MTAmazon plugin as per the instructions here.
This plug-in allows MT to get images and links from Amazon via xml.
Install the Process Tags plug-in.
MT doesn't process any plug-in tags appearing in your entries. Using the Process Tags plug-in, we're going to force it to.
Replace all occurrences of '$MTEntryBody$' or 'MTEntryBody' in your templates with 'MTEntryBody process_tags="1"'
The templates you need to edit in the default MT implementation are:  the Main Index (index.html), the Category Archive, the Date-Based Archive and the Individual Entry Archive. This will force MT to process all MT and plug-in tags appearing in your blog entries every time it rebuilds the site. Note that since your entries typically appear on multiple pages, this could slow your site rebuilds considerably if it's a very big site.
Caveat 2 also comes into play here. With the process tags plugin enabled you'll now have to think of all entries on your blog as code. In a sense, your entries are now MT templates. 
Adam Kalsey, plugin author
Using [the process tags plugin] can be dangerous if you don't think about what you are doing. For example, if you have the PerlScript plugin installed, any blog author could execute arbitrary Perl code on your server. Another example would be putting an MTEntries block inside your entry. When MT rebuilt, it would find the MTEntries block in the entry, and load all those entries. One of the entries that it would load would be itself, again causing MT to find the MTEntries block, and so on, creating an infinite loop. 
I can tell you from personal experience, that last scenario is unpleasant and likely to upset your ISP and the people you're sharing your server with. It makes me nervous just having the MTEntryBody text in this post. You can read all about it in the plugin forum at www.movabletype.org.Comments, which of course any visitor to your site can write, are safe because in this implementation they are not processed by the plugin. Don't extend the process tags plugin to MT comments -- that would be very bad.

Install Zempt, w.Bloggar or SharpMT, if you haven't already.
Eventually I'll implement a means for doing this without a special editor, but for now this is how we'll generate the MTAmazon plug-in code.
Start Zempt, w.Bloggar or SharpMT. In Zempt, open Tools->Preferences from the menu and click on "Music" in the selection list on the left of the dialogue window. With w.Bloggar it's File->Settings, then click on the "Media" tab. For SharpMT, select Tools->Options then click the "Editor" tab.
There are two things to do here. First, make sure you've got the proper MediaPlayer or WinAmp software installed. There are links in the Zempt and w.Bloggar dialog windows if you don't. Second, replace the current contents of the media formatting string edit box with the following code.
 

   
&lt;div class=&quot;media&quot; align="right"&gt;
&lt;MTAmazon search=&quot;%A% %B%&quot; line=&quot;music&quot; lastn=&quot;1&quot;&gt; 
        &lt;a href=&quot;http://www.amazon.com/exec/obidos/ASIN/
        &lt;MTAmazonASIN&gt;/&lt;MTAmazonAssociateID&gt;&quot; target=&quot;_blank&quot;&gt;
            &lt;img src=&quot;&lt;MTAmazonMediumImage&gt;&quot; hspace=&quot;4&quot; align=&quot;right&quot; 
            border=&quot;0&quot;&gt;&lt;/a&gt;
         &lt;strong&gt;&lt;i&gt;
        &lt;a href=&quot;http://www.synaptic.bc.ca/MyMessyWorkbench/archives/2003/12/presently_listening_to.php&quot;&gt;
            Presently listening to:&lt;/a&gt;
        &lt;/i&gt;&lt;/strong&gt;&lt;br /&gt; %T% - %A% - %B% (%D%)&lt;br /&gt;&lt;br /&gt;
        &lt;MTAmazonArtist&gt;&lt;br /&gt;
        &lt;a href=&quot;http://www.amazon.com/exec/obidos/ASIN/
        &lt;MTAmazonASIN&gt;/&lt;MTAmazonAssociateID&gt;&quot; target=&quot;_blank&quot;&gt;
            &lt;MTAmazonTitle&gt;&lt;/a&gt;&lt;br /&gt;
        &lt;MTAmazonReleaseDate format=&quot;%B %e, %Y&quot;&gt;
&lt;/MTAmazon&gt;
&lt;/div&gt;&ltbr clear="right" /&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt; 



You'll need to remove the formatting, so the whole bit is a single line of text.The %X% stuff is where Zempt and w.Bloggar are going to put the song Title, Artist name, alBum title and song Duration. If you're working with SharpMT, then you need to do some substitution:

%T% to [SONG]
%A% to [ARTIST]
%B% to [ALBUM]
%D% to [DURATION]

To make your life a little easier I've placed a couple versions of this code, both formatted and unformatted, in MediaInfoString.txt, which you can open in a non-word-wrapped text editor.
You might just want to look at your music library in Media Player or WinAmp and make sure all those titles and names are correct, or you'll get some unusual results from Amazon's search.



OK. Recheck your steps and you're ready to go. 

Place your cursor where you want the Presently listening to: code to go, and click on the little musical notes button, wherever it is on your particular editor. Voila!

Now, you can either continue editing, or copy and paste the code to whatever other editor you prefer.

Happy musical bloggin!

p.

/" target="_blank">" hspace="4" align="right" border="0">Presently listening to:Biko - Peter Gabriel - Shaking The Tree (06:53)/" target="_blank">
]]></description>
<guid isPermaLink="false">36@http://www.synaptic.bc.ca/MyMessyWorkbench/</guid>
<dc:subject>Gems</dc:subject>
<dc:date>2003-12-14T06:10:54-08:00</dc:date>
</item>


</channel>
</rss>
