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

Category List via SSI / Global

Quote Reply
Category List via SSI / Global
Heya all,

I have a few LinksSQL installations. I'd like to bring together the categories displayed on the "home page" of each of these instances onto a single page.

I'd simply like to pull the category names, including the number of links as it would normally show up on the main page onto the home page of another instance.

Any ideas how to do this? I'd prefer for it to be a static SSI. The number of links does not have to be updated in real time. If I can build a simple category list and pull that onto the other page with a global or SSI that would be best.

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] Category List via SSI / Global In reply to
I'm in the midst of something similar - making a Links site map available to other sites on the same server, but the only way I could see to do it was to use the pagebuilder plugin to write a clean file which could be read into pages on other sites.

I'm reading the file in via separate Perl scripts on my own server, so I can roam between virtual hosts - the problem with SSI is that it can only reference it's own domain, so you would need some external scripting to move the file(s) from one domain to another.
Quote Reply
Re: [sangiro] Category List via SSI / Global In reply to
I remember that there was a Global
at GTs Resources:
http://www.gossamer-threads.com/...L/Globals/index.html

Best regards from
Bremen/Germany

Lothar
Quote Reply
Re: [eljot] Category List via SSI / Global In reply to
Doesn't seem to have exactly what I'm looking for. Remember I'm pulling the categories from a different installation of LSQL onto the home page of another....

In the end here's what I'd like to see on one home page:

Code:
LinksSQL AA LinksSQL BB
Category 1 (2) Category 1 (7)
Category 2 (5) Category 2 (3)
Category 3 (1) Category 3 (3)
Category 4 (8)

Ideal would be to build a simple page containing the categories for BB and include it via SSI, or somehow pull it in with a global when I build the static home page for AA.

Safe swoops
Sangiro

Last edited by:

sangiro: Feb 26, 2004, 6:00 AM
Quote Reply
Re: [CrazyGuy] Category List via SSI / Global In reply to
Quote:
the only way I could see to do it was to use the pagebuilder plugin

I have pagebuilder and was thinking about this as well. Not sure how to configure it to build the list I'm looking for though...

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] Category List via SSI / Global In reply to
I think it would go something like:

Set up a global like this which produces a list of top-level categories (doesn't inc numbers of links but that should be solvable):

Code:
sub {
my $tags = shift;
my $cat_db = $DB->table('Category');
$cat_db->select_options ('ORDER BY Name');
my $sth = $cat_db->select ( { FatherID => 0}, ['Full_Name','Name'] );
my $output="";
while (my ($root_cat,$full_name) = $sth->fetchrow_array) {
my $url = $cat_db->as_url($root_cat);
$output .= qq~<a href="$CFG->{build_root_url}/$url/">$full_name</a><BR>\n~;
}
return $output;
}

Then a "simple" pagebuilder page with a template containing nothing other than the tag for that global. Set an appropriate name and path and it should output a file with only the html for your category list.

Bit of magic to put it in the right domain space and it should be eminently SSI-able into another page.
Quote Reply
Re: [sangiro] Category List via SSI / Global In reply to
If you want to pull things in from a different installation, find the global that you want to use, and then instead of

my $db = $DB->table('Category');

use this (replace /path/to/admin with the path to the admin of the other installation):

use lib('/path/to/admin');
my $db = GT::SQL->new('/path/to/admin/defs')->table('Category');
Quote Reply
Re: [afinlr] Category List via SSI / Global In reply to
Thanks all,

Used Laura's suggestion and was able to pull this list in without the use of PageBuilder. Smile

Any thoughts on how I can add the number of links in each category to the global above?

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] Category List via SSI / Global In reply to
It's just another field in the category table so you just add it in:

my $sth = $cat_db->select ( { FatherID => 0}, ['Full_Name','Name','Number_of_Links'] );
my $output="";
while (my ($root_cat,$full_name,$number) = $sth->fetchrow_array) {
Quote Reply
Re: [afinlr] Category List via SSI / Global In reply to
Most excellent! Like a charm. Thanks. Smile

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] Category List via SSI / Global In reply to
i like this global. i have a few questons. how can i make category list display into 2 separate equal columns