Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

XML Feed adding Categories to Results

Quote Reply
XML Feed adding Categories to Results
Does anyone have a way to add Categories to the XML Feed Results as displayed by the file
xml_search_results.xml. Right now the XML Parser displays only title, url, description, but I would like to add the categories so that the feed would be similar to search.cgi.

Any info would be great.
Quote Reply
Re: [mddrew01] XML Feed adding Categories to Results In reply to
Create a global, say catname:

Code:
sub {
my ($rec) = @_;
my $id = $rec->{ID};
my $db = $DB->table ('Category','CatLinks');
my $sth = $db->select ( { 'CatLinks.LinkID' => $id }, ['Category.ID', 'Category.Name'] );
my $cat;
while (my ($id,$name) = $sth->fetchrow_array) {

$name =~ s/ /_/g;
$cat = "$name";

}
return $cat;
}

The, in the xml_search_results.html templae, insert:
<category><%catname%></category>

That should do it.
John