Categories
Programming Languages Technology Weblogging

Trackback technologies

Recovered from the Wayback Machine.

Trackback stuff.

First, to re-cap, this page covers how to add trackback to your individual pages, and to force page re-builds when a new trackback ping arrives for the specific page.

I put the code for the Recent Trackbacks and Backtrack into text files that you can download and use in your MT weblog. It’s worked nicely since I put it in, and is ready for others to try. Consider it beta, and it’s not wrapped up pretty, pretty, but tech is gritty. Pretty bows get in the way of the moving parts.

The first file is backtrack.txt, which contains the Backtrack technology. To use this, modify the HTML to create a layout you want and then rename the file to “backtrack.php”, putting it into your main weblog directly.

Next, modify the individual daily archive page template to call the file:

 

<MTPingsSent>
<a href=”http://weblog.burningbird.net/backtrack.php?ping=<
$MTPingsSentURL$>”><$MTPingsSentURL$></a><br />
</MTPingsSent>

 

That’s it for backtrack.

Last, the PHP/MySql code that displays the Recent Trackbacks in the sidebar can be found in this file. To use, copy it into your main index template where you want the recent trackback list to go. You will need to change the username, password, weblog id, and database name in the code to match your environment. The values that need to change are bolded below:

 

<?php

$link = mysql_connect(“localhost”, “user“, “password“)
or die(“database errors”);
mysql_select_db (“database_name“);

$query = “SELECT tbping_id, tbping_source_url, tbping_title,
entry_title, entry_id FROM mt_entry, mt_tbping, mt_trackback where tbping_blog_id = 2 and entry_id = trackback_entry_id and trackback_id = tbping_tb_id ORDER BY tbping_id desc limit 10″;

$result = mysql_query($query) or die(“database errors”);

while ($line = mysql_fetch_array($result, MYSQL_NUM)) {
$input = $line[4];
$input = str_pad($input, 6, “0”, STR_PAD_LEFT);
printf(“<a href=’%s’>%s</a> on <a style=’font-weight: normal’ href=’http://weblog.burningbird.net/fires/%s.htm’>%s</a><br />”, $line[1],$line[2], $input, $line[3]);
}

/* Free resultset */
mysql_free_result($result);

/* Closing connection */
mysql_close($link);
?>

 

Any suggestions to improve the code are welcome — feel free to leave in comments, or cross-post…with trackbacks, of course.

So, there you go. New Toys. Enjoy.