<?php
// Part of my ugly hack for making trackbacks to TopicExchange easier to do and more visible on the weblog
// 18.07.04 Stephanie Booth aka bunnywabbit_ on #wordpress -- http://climbtothestars.org/ for questions or fixes

// these functions live in my-hacks.php

// this function lists the topic exchange channels stored as meta data
function list_ite_channels($separator="' ")
{
    
$channels=get_post_custom_values("ite_topic");
    
$channels=array_unique($channels);
    
$channels=explode(" "$channels);          
    foreach(
$channels as $topic)
    {
        
$ite_url=make_ite_url($topic);
        
$ite_link='<a href="' $ite_url '" title="TopicExchange: view other posts from the same channel.">' $topic '</a>';
        
$ite_list[]=$ite_link;
    } 
    
$the_list=implode($separator$ite_list);
    return 
$the_list;
}

// this function checks if there are topic exchange channels, and if there are, outputs html and list
function the_ite_channels($separator="' ")
{
    
$channels=get_post_custom_values('ite_topic');
    if(
$channels!='')
    {
        
?>
        <p class="topicexchange"><a href="http://climbtothestars.org/archives/2004/07/19/easier-topicexchange-trackbacks-for-wordpress/" 
title="What is this about? How was it done? More information.">TopicExchange</a>: 
        <?php
        
print(list_ite_channels($separator));
        
?>
        </p>
        <?php
    
}
}

// recompose ITE url
function make_ite_url($topic)
{
    
$ite_url='http://topicexchange.com/t/' $topic '/';
    return 
$ite_url;
}


?>