Waypath Plug-in/Hack by LaughingLizard http://dinki.mine.nu/weblog or http://dinki.mine.nu/word/ For WordPress, B2 and other php based weblogs: 1) Open b2template.functions.php in your b2-include folder and add this function inside the tags (or in your my-hacks.php file if you are using WordPress 1.0+) # Plug_in for Waypath Hack (http://www.waypath.com) for b2 and WordPress # by LaughingLizard http://dinki.mine.nu/weblog/ and http://dinki.mine.nu/word/ function return_content($more_link_text='(more...)', $stripteaser=0, $more_file='') { global $id, $post; $output = stripslashes($post->post_title); if (!empty($post->post_password)) { // if there's a password $output = 'Protected: ' . $output; } $content = get_the_content($more_link_text, $stripteaser, $more_file); $content = convert_bbcode($content); $content = convert_gmcode($content); $content = convert_smilies($content); $content = convert_chars($content, 'html'); $content = apply_filters('the_content', $content); return $content.$output; } function waypath($content) { if (!preg_match ("//i", $content)) { //include("xmlrpc.inc"); $client = new xmlrpc_client("/", "xmlrpc1.waypath.com", 80); $short_content = substr($content, 0, 2000); #send first 2000 characters of the post # this function has been defined further under http://www.waypath.com/apis/ # variables can be changed to suit your own needs $msg = new xmlrpcmsg('inline.relatedByExcerpt', array( new xmlrpcval('23000023'), # user key (anonymous) new xmlrpcval("45", "int"), # last 45 days new xmlrpcval($short_content, "string"), # url new xmlrpcval("3", "int"), #style new xmlrpcval("10", "int"), # maxresults new xmlrpcval("0", "int"), # sort by relevance (1==date) new xmlrpcval("nothing related", "string"), new xmlrpcval("3", "int"), # focus (1=loose,2=normal,3=strict) new xmlrpcval(array(), "array"), # includedSites new xmlrpcval(array(), "array") # excludedSites )); $client->setDebug(0); $result = $client->send($msg); if ($result->faultCode() != 0) { print "Couldn't process request: " . $result->faultString(); return; } function print_vars($obj) { $arr = get_object_vars($obj->val); while (list($prop, $val) = each($arr)) echo "\t$prop = $val\n"; } $outString=$result->value(); $arr=xmlrpc_decode($outString); return $arr[box]; } } 2) Open index.php (or your template php file) and add this anywhere inside the start_b2 function (preferably after the comments tags)(start_wp if you are using WordPress 1.0+): 0) {echo waypath(return_content());}?> 3) Add this to your wp-layout.css or your layout2b.css (wp-layout.css) (anywhere): .waypath-box { font-size: 70%; border: thin solid #00288C; margin: 5px; background-color: #F0F0F0; } .wp-box-title { margin-left: 3px; margin-bottom: 5px; } .wp-item { margin-top: 3px; margin-bottom: 10px; margin-left: 3px; margin-right: 3px; line-height: 1; } .wp-item-title { margin-bottom: 2px; } .wp-item-origin { margin-top: 2px; margin-bottom: 3px; } .wp-item-summary { margin-top: 3px; line-height: 1; } For WordPress users who use mod_rewrite, here is a suggestion from 'gat' from the WordPress forums: instead of placing: 0) {echo waypath(return_content());}?> in my template (index.php to be clear), i placed just: in my comment template. this because, if you try, you will see that the '..if {$p..' thing will not work if you use apache mod_rewrite to generate permalinks (ie. http://gat.blogo.net/2003/11/15/indecisioni/).. just because, i think, the $p variable is not used (is it? well, doesn't matter.. it doesnt work, believe me :) ) this way you could access your related post going to the item page, or clicking the comment link (which is the same..).. i did this way, placed a link named "BlogospheRelated" at the bottom of my posts, which brings back the comment page + anchor (such as #related) in the comment page where the plugin shows his output. Check out his page and implementation at http://gat.blogo.net For non-b2/wordpress blogs which use php: 1)simply put the following inside your main index file of your blog and call it with where $content is the information you are providing to get the related blogs for. You also have to make sure xmlrpc.inc is in your blog folder. This can be downloaded from https://sourceforge.net/projects/phpxmlrpc/. # Plug_in for Waypath Hack (http://www.waypath.com) for b2 and WordPress (and others) # by LaughingLizard http://dinki.mine.nu/weblog/ and http://dinki.mine.nu/word/ function waypath($content) { if (!preg_match ("//i", $content)) { include("xmlrpc.inc"); $client = new xmlrpc_client("/", "xmlrpc1.waypath.com", 80); $short_content = substr($content, 0, 2000); #send first 2000 characters of the post # this function has been defined further under http://www.waypath.com/apis/ # variables can be changed to suit your own needs $msg = new xmlrpcmsg('inline.relatedByExcerpt', array( new xmlrpcval('23000023'), # user key (anonymous) new xmlrpcval("45", "int"), # last 45 days new xmlrpcval($short_content, "string"), # url new xmlrpcval("3", "int"), #style new xmlrpcval("10", "int"), # maxresults new xmlrpcval("0", "int"), # sort by relevance (1==date) new xmlrpcval("nothing related", "string"), new xmlrpcval("3", "int"), # focus (1=loose,2=normal,3=strict) new xmlrpcval(array(), "array"), # includedSites new xmlrpcval(array(), "array") # excludedSites )); $client->setDebug(0); $result = $client->send($msg); if ($result->faultCode() != 0) { print "Couldn't process request: " . $result->faultString(); return; } function print_vars($obj) { $arr = get_object_vars($obj->val); while (list($prop, $val) = each($arr)) echo "\t$prop = $val\n"; } $outString=$result->value(); $arr=xmlrpc_decode($outString); return $arr[box]; } } 2) Add this to your CSS file: .waypath-box { font-size: 70%; border: thin solid #00288C; margin: 5px; background-color: #F0F0F0; } .wp-box-title { margin-left: 3px; margin-bottom: 5px; } .wp-item { margin-top: 3px; margin-bottom: 10px; margin-left: 3px; margin-right: 3px; line-height: 1; } .wp-item-title { margin-bottom: 2px; } .wp-item-origin { margin-top: 2px; margin-bottom: 3px; } .wp-item-summary { margin-top: 3px; line-height: 1; } Usage for all versions: Not much to this, every post that this function is called upon will show related topics from Waypath. An entry can be excluded from the "Waypath related entries" by adding to the beginning of the entry.