manual-tb.php?tb_url=<$MTEntryTrackbackLink encode_url="1"$> &tb_title=<$MTEntryTitle encode_url="1"$> &tb_entry_url=<$MTEntryLink encode_url="1"$>">Manual Trackback Note, this whole example should be one line. No spaces can occur within the href attribute in a link. Also, the encode_url="1" attribute must used to for the link to work properly and to have valid HTML. The advantage of the POST method is that the variables are hidden to the visitor. The disadvantage is that a HTML form is required with a submit button. Here is an example using forms and the POST method:
This script is embedded within a simple XHTML 1.0 Transitional document. Some simple CSS styling has been applied. The following CSS classes are employed within this script: p.rule = a horizontal separator after introduction text div.error = formatting for error messages p.ping = final message if ping was successful or not This script can be used as a stand-alone document, or as a Movable Type template. The filename of this script can be renamed to anything. Also, this script can be placed in any directory. In either case, set the two global variables near the beginning of the script. Just be sure that your GET URL or POST action reflect the filename and directory changes. (Don't forget to modify the URL to Snoopy.class.inc if needed.) This script was inspired by Adam Kalsey's SimpleTrack (http://kalsey.com/). This script would have been impractical or un-user-friendly if it was not for the clue to use the Snoopy php class. Please feel free to use, copy and/or modify this script for your needs. You are not required to place my name or link to my website within this script, but the acknowledgement would be greatly appreciated. Note also that I am not responsible for any positive or negative effects of this script. Happy coding... */ ?> Manual Trackback

Manual Trackback

in a Movable Type template $myBlogName = 'Name of Your Weblog'; // or use <$MTBlogName$> in a Movable Type template RetrieveTBData($tb); if ($tb['tbURL'] == '') { // must have a trackback URL to work ShowNoTrackback(); } else { if (!$tb['checkDataFlag']) { // first visit to script ShowIntro(); ShowTBInfo($tb); ShowForm($tb); } else { // second or more visits to script $error = CheckData($tb, $errorArray); if ($error) { // if error in a form field, give user another chance to fix ShowTBInfo($tb); ShowErrors($errorArray); ShowForm($tb); } else { // all form fields contain data ShowTBInfo($tb); Submit($tb); WrapUp($tb); } } } ?> Somehow, you were sent to this page without any trackback information. Please access this page from an individual entry archive page.

'."\n"; } function ShowIntro() { // Display introduction about trackback system on first trip to form. echo '

Trackbacks were developed by Movable Type to enhance cross-site conversations. They are like comments but are located on someone else’s weblog. If by chance you were inspired by one of my weblog entries and felt compelled to write your own weblog entry on your website (or wrote something similar to my entry), you can send me a trackback instead of writing a comment linking back to your website.

'."\n"; echo '

If you do not use Movable Type or some other system that supports trackback, you can still participate by using this manual trackback form.

'."\n"; echo '

'."\n"; } function ShowTBInfo($tb) { // Display trackback URL and if included, title of its weblog entry with corresponding link. if ($tb['myEntryTitle'] != '') { if ($tb['myEntryURL'] != '') { echo '

For entry:  '.$tb['myEntryTitle'].'

'."\n"; } else { echo '

For entry:  '.$tb['myEntryTitle'].'

'."\n"; } } echo '

Trackback URL:  '.$tb['tbURL'].'

'."\n"; } function ShowForm($tb) { // Show form echo '
'."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo '

'."\n"; echo ''."\n"; echo '

'."\n"; echo ''."\n"; $link = ($tb['blogEntryURL'] == '' && !$tb['checkDataFlag']) ? 'http://' : $tb['blogEntryURL']; echo '

'."\n"; echo ''."\n"; echo '

'."\n"; echo '

'."\n"; echo ''."\n"; echo '
'."\n"; } function CheckData($tb, &$errorArray) { // Return 0 if no errors and 1 if there are errors with list of errors in $errorArray $errorArray = array(); if (!$tb['blogName']) $errorArray[] = 'No weblog name entered'; if (!$tb['blogEntryTitle']) $errorArray[] = 'No title or date for weblog entry entered'; if (!$tb['blogEntryURL']) $errorArray[] = 'No weblog URL entered'; else { ereg('(^http://)(.{0,})', $tb['blogEntryURL'], $pieces); if ($pieces[1] != 'http://') { $errorArray[] = 'Weblog URL needs to begin with http://'; } elseif ($pieces[2] == '') { $errorArray[] = 'No weblog URL entered'; } } if (!$tb['blogExcerpt']) $errorArray[] = 'No excerpt entered'; $errorCount = count($errorArray); $errorFlag = ($errorCount > 0); return $errorFlag; } function ShowErrors($errorArray) { // Show errors echo '

Errors were found:

'."\n"; echo '
    '."\n"; foreach ($errorArray as $error) { echo ''.$error.''."\n"; } echo '
'."\n"; } function Submit($tb) { // Send trackback ping and display results // For specifications, see http://www.movabletype.org/docs/mttrackback.html $snoopy = new Snoopy; $submitURL = $tb['tbURL']; $submitVars['Content-Type'] = 'application/x-www-form-urlencoded'; $submitVars['title'] = $tb['blogEntryTitle']; $submitVars['url'] = $tb['blogEntryURL']; $submitVars['blog_name'] = $tb['blogName']; $submitVars['excerpt'] = $tb['blogExcerpt']; $snoopy->submit($submitURL, $submitVars); $pingReply = $snoopy->results; // search through XML reply for any ping errors if (ereg('([01])', $pingReply, $pieces)) { $pingError = $pieces[1]; } else { $pingError = 1; } if (!$pingError) { $message = 'Trackback was successful!'; } else { if (ereg('(.{0,})', $pingReply, $pieces)) { $message = 'Error:  '.$pieces[1]; } else { $message = 'Error:  Unknown'; } } echo '

'.$message.'

'."\n"; } function WrapUp($tb) { // Display links back to homepage and/or to originating entry page global $myHomeURL, $myBlogName; echo '

Return to '.$myBlogName.' Home'; if ($tb['myEntryURL'] != '' && $tb['myEntryTitle'] != '') { echo ' or '.$tb['myEntryTitle'].''; } echo '

'."\n"; } ?>