A lot of people using Skins on their blogs want all of the elements of their journal site to have skins on them. This made a lot of people use Individual Archives as popups so that they could be skinned, too. Unfortunately, with the advent of Trackback in MT2.2, there wasn't a good work-around to skin that window because only the trackback listing template and index template were updated upon receiving a ping. And rebuilding every time a ping comes in is a bit tedious of an option, so a lot of people just went with the trackback popups even though it couldn't be skinned.
For people using the MySQL backend and PHP for their files, there is an option now!
Objective – Add auto-updating incoming trackback pings to the Individual Archive, which can be used as a popup for skinning purposes or just for organizing all of the info about a single post into a single screen instead of multiple popups as the default.
Required – Individual Archives with PHP extensions, the MySQL backend and at least MT2.2; setup of a connect.php file as described in the first section of the MySQL authors post. Include that connect file in the top of your Individual Archive template.
This code will set up a header that has the count of trackbacks, followed by the link and excerpt of each trackback received, and then the Trackback URL that can be used to ping:
<MTEntryIfAllowPings>
<?
$blogid = "2";
//replace this with the blog_id of your blog
$entry_id = "<$MTEntryID$>";
$pingcount = mysql_query("SELECT p.tbping_blog_id, t.trackback_entry_id FROM mt_tbping p, mt_trackback t WHERE (p.tbping_blog_id = $blogid) and (t.trackback_entry_id = $entry_id) and (t.trackback_id = p.tbping_tb_id)");
$count = mysql_num_rows($pingcount);
echo "<a name=\"pings\"></a>";
echo "<div class=\"bloghead\">Trackbacks on this post: ", $count, "</div>";
$pingarray = "SELECT p.tbping_source_url, p.tbping_blog_name, p.tbping_created_on, p.tbping_excerpt, p.tbping_tb_id, t.trackback_id, t.trackback_entry_id FROM mt_tbping p, mt_trackback t WHERE (p.tbping_blog_id = $blogid) and (t.trackback_entry_id = $entry_id) and (t.trackback_id = p.tbping_tb_id)";
$resultping = mysql_query($pingarray) or die (mysql_error());
while ($row = mysql_fetch_array($resultping)) {
$url = ($row['tbping_source_url']);
$blog = ($row['tbping_blog_name']);
$date = date("F d, Y h:i", strtotime($row['tbping_created_on']));
$excerpt = ($row['tbping_excerpt']);
echo "<div class=\"blogbody\"><p>", $excerpt, "</p></div>";
echo "<div class=\"blogfoot\">Posted by ";
echo "<a href=\"", $url, "\" target=\"_blank\">", $blog, "</a>";
echo " <i>", $date, "</i></div>";
}
?>
<span class="subhead">Ping this post</span><br /><br />
<div class="code"><$MTEntryTrackbackLink$></div>
</MTEntryIfAllowPings>
With the advent of MT2.5, you can also add a section to display the outgoing pings. I was originally doing it with this code, which will work in MT2.2+:
<?
$entry_id = "<$MTEntryID$>";
$outpings = mysql_query("SELECT entry_pinged_urls FROM mt_entry WHERE $entry_id = entry_id and entry_pinged_urls !=\"\"");
while ($rowout = mysql_fetch_array($outpings)) {
echo "<a name=\"outpings\"></a>";
echo "<div style=\"font-weight:bold; text-align:center;\">URLs Pinged:</div>";
echo "<div class=\"code\">", ($rowout['entry_pinged_urls']), "</div>";
}
?>
But now with MT2.5, there's a tag for this:
<a name="outpings"></a>
<div style="font-weight:bold; text-align:center;">URLs Pinged:</div>
<div class="code"><MTPingsSent>
<$MTPingsSentURL$><br />
</MTPingsSent></div>
I set up a name sections for each of these, so I could have navigation on the top of each Individual Archive template like this:
<div align="center"><a href="#comments">comments</a> | <a href="#pings">incoming pings</a> | <a href="#outpings">outgoing pings</a></div>
Customization notes: I used my div class names in the above examples – you may want to tweak the styles to your liking and put your own class names into it – bloghead is what my date is in, blogbody is the post, blogfoot is the bottom line with posted info, subhead is my subject line. And I have a code class that has added padding and shows in Courier New so that the text looks more like code.