right that's exactly what I mean.
and i a=want to call the script linke this
detail_category.cgi?ID=<%category_id%>
I tried this before with detailed.cgi but this does not work.
I used this code, and chanced all link codes into the category codes found in page.cgi
============================================================
#!/usr/local/bin/perl
# ==================================================================
# Links SQL - enhanced directory management system
#
# Website : http://gossamer-threads.com/
# Support : http://gossamer-threads.com/scripts/support/
# Revision : $Id: page.cgi,v 1.8 2000/11/09 21:16:57 alex Exp $
#
# Copyright (c) 2000
Gossamer Threads Inc. All Rights Reserved.
# Redistribution in part or in whole strictly prohibited. Please
# see LICENSE file for full details.
# ==================================================================
#
# This program expects EITHER an ID or a Page passed in.
# ID is checked for a valid ## and existing record, and if ti exists,
# a "detailed" page is printed for that link, as if it were a static page.
# ie: no url translations.
# if no ID is passed in, Page is checked, and if it exists, it's passed
# to the print template routine, which does the existence checking
#
# ==================================================================
use strict;
use lib '/home/ridesworld/www/cgi-bin/links/admin';
use Links qw/$IN $DB $CFG $USER/;
use Links::Build;
use Links::SiteHTML;
use vars qw/$LINKDB $CATDB/;
main();
sub main {
# --------------------------------------------------------------
# Wrap in a subroutine to prevent possible mod_perl probs.
#
# Create our database objects.
$LINKDB ||= $DB->table('Links');
$CATDB ||= $DB->table('Category');
if ($IN->param('ID')) {
&generate_detailed_page ()
} else {
&generate_detailed_page()
}
}
sub generate_detailed_page {
# --------------------------------------------------------
# This routine build a single page for every link.
#
my ($page, $id, $link);
$id = $IN->param('ID');
$page = $IN->param('Page');
if (!$id and !$page) {
print $IN->header();
print Links::SiteHTML::display ('error', { error => Links::language('PAGE_INVALIDDETAIL', $id) });
return;
}
($id) && ($link = $LINKDB->get ($id, 'HASH'));
if ($id and !$link) {
print $IN->header();
print Links::SiteHTML::display ('error', { error => Links::language('PAGE_INVALIDDETAIL', $id) } );
return;
}
## need to do some housekeeping, and set up some variables:
my ($cat_id, $cat_name) = %{$LINKDB->get_categories ($link->{'ID'})}; ## Returns the category name & ID from link ID
$link->{'title_linked'} = Links::Build::build ('title_linked', "$cat_name/$link->{Title}");
## Fix up the HTML references
my ($begin, $url, $output); ## setting up for a very, very complicated regex, taken from Links.pm clean_output
$link->{'title_linked'} =~ s!(<a[^>]+href\s*=\s*["']*)$CFG->{build_root_url}/?([^"'>]*)!
($begin, $url) = ($1, $2);
$output = "$1$CFG->{db_cgi_url}/page.cgi?g=" . $IN->escape($2);
$output;
!eisog;
if ($link) {
print $IN->header();
print Links::SiteHTML::display ('detailed', $link);
return;
} elsif ($page) {
print $IN->header();
print Links::SiteHTML::display ($page);
return;
} else {
print $IN->header();
($id) ?
print Links::SiteHTML::display ('error', { error => Links::language('PAGE_INVALIDDETAIL', $id) } ) :
print Links::SiteHTML::display ('error', { error => Links::language('PAGE_INVALIDDETAIL', $page) } );
return;
}
}
1;
===========================================================
Ok I grab this code from you Pugdog.
could you give me an example with the category codes in it.
It begin to failed near
## need to do some housekeeping, and set up some variables:
my ($cat_id, $cat_name) = %{$LINKDB->get_categories ($link->{'ID'})}; ## Returns the category name & ID from link ID
$link->{'title_linked'} = Links::Build::build ('title_linked', "$cat_name/$link->{Title}");
Cheers,
Ericho