Gossamer Forum
Quote Reply
Re: [gotze] JSON In reply to
I love GT::JSON Smile

Here is a global that produces a list of categories in JSON:

Code:
sub {
use GT::JSON;
my $category = $DB->table('Category');
$category->select_options('ORDER BY Full_Name');
my $sth = $category->select(['Has_New_Links','Newest_Link','Number_of_Links','ID','FatherID','Name','Full_Name'] );
my @cats;
while (my $cat = $sth->fetchrow_hashref) {
$cat->{URL} = "$CFG->{build_root_url}/" . $category->as_url($cat->{Full_Name}) . "/$CFG->{build_index}";
push @cats, $cat;
}
encode_json { categories_json => \@cats };
}

Example:
http://slashdemocracy.org/...ge.cgi?page=CatsJSON
Subject Author Views Date
Thread JSON gotze 20731 Jul 24, 2010, 11:38 AM
Post Re: [gotze] JSON
Andy 20392 Jul 25, 2010, 1:42 AM
Thread Re: [gotze] JSON
tandat 20399 Jul 25, 2010, 2:49 AM
Thread Re: [tandat] JSON
gotze 20376 Jul 25, 2010, 7:49 AM
Thread Re: [gotze] JSON
gotze 20375 Jul 25, 2010, 11:58 AM
Thread Re: [gotze] JSON
gotze 20357 Jul 25, 2010, 12:27 PM
Thread Re: [gotze] JSON
Matthias70 20351 Jul 25, 2010, 12:36 PM
Thread Re: [Matthias70] JSON
gotze 20356 Jul 25, 2010, 12:57 PM
Thread Re: [gotze] JSON
Matthias70 20300 Jul 26, 2010, 9:27 AM
Post Re: [Matthias70] JSON
gotze 20281 Jul 26, 2010, 10:40 AM
Thread Re: [gotze] JSON
courierb 19716 Nov 11, 2011, 9:12 PM
Thread Re: [courierb] JSON
Andy 19733 Nov 13, 2011, 7:08 AM
Thread Re: [Andy] JSON
courierb 19694 Nov 19, 2011, 6:10 PM
Thread Re: [courierb] JSON
Andy 19718 Nov 20, 2011, 8:16 AM
Thread Re: [Andy] JSON
courierb 19700 Nov 20, 2011, 5:13 PM
Thread Re: [courierb] JSON
courierb 19685 Nov 20, 2011, 6:15 PM
Thread Re: [courierb] JSON
Andy 19695 Nov 21, 2011, 12:58 AM
Thread Re: [Andy] JSON
courierb 19637 Nov 22, 2011, 3:41 PM
Thread Re: [courierb] JSON
courierb 19630 Nov 22, 2011, 4:02 PM
Post Re: [courierb] JSON
Andy 19619 Nov 22, 2011, 11:58 PM
Post Re: [gotze] JSON
courierb 19709 Nov 20, 2011, 5:09 PM