Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

all links for 1 cat/sub-cat on 1 page ?

Quote Reply
all links for 1 cat/sub-cat on 1 page ?
Hello all,

Maybe someone make this and can tell me how to make it:

- If i go to a main-category page, i wanna see all the links and subcats-links on 1 page. Like this:

The Sport page (main cat sport) have to look like this

Tennis (is a sub-cat like sport/tennis)
link 1
link 2

Soccer (is a sub-cat like sport/soccer)
link 1
link 2

I think you will get the picture, maybe someone can help me with this ?

Allready thanks.

Regards Startpoint.

Quote Reply
Re: all links for 1 cat/sub-cat on 1 page ? In reply to
This can create a logical problem.

And lots of redundant data.

To what depth would you want this to occur?

Just the first level categories?

I can't visualize any "portable" solution, ie: one that would work on various sites, or under most conditions. All fall subject to the problems of multiple depths and too many links.


PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://postcards.com/FAQ


Quote Reply
Re: all links for 1 cat/sub-cat on 1 page ? In reply to
Thanks pugdog!

Well pugdog,

Just the first 2 levels. Like Sport/allkind off sub-cats. So no sub-subcats..

Hope you can help me ?

Regards STartpoint.

Quote Reply
Re: all links for 1 cat/sub-cat on 1 page ? In reply to
Can any help me on this 1?

Allready thanks.

Regards Startpoint..

Quote Reply
Re: all links for 1 cat/sub-cat on 1 page ? In reply to
As I said, I really can't think of any way to do that easily, cleanly or with a minimum of effort.

You essentially need to rewrite the routines to write out the category pages so that they don't create new category pages, but keep appending.

Maybe writing out all the category pages, then writing out the changed category pages on top of the existing structure would work, and trap errors.

Not something that can be done in a forum post. Sorry!

PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://postcards.com/FAQ


Quote Reply
Re: all links for 1 cat/sub-cat on 1 page ? In reply to
Thx pugdog,

Well i have to wait till next version is there then i will make it.

Regards Startpoint.

Quote Reply
Re: all links for 1 cat/sub-cat on 1 page ? In reply to
I've started a "featured links" mod. What it does is pull a featured link from the category, and display it under the category name on category page listings.

It's bare-bones, but it's fully self contained. I'm posting it here only so that maybe some people will help with this idea... It's easy and flexible to modify. It might be something similar to what you want, but not exactly.

Code:
sub grab_featured_link { ## expects a CategoryID number only
# --------------------------------------------------------
#
my $cat_id = shift; # Contains a vallid categoryID so we are not going to check it.
my $LINKDB = new Links::DBSQL $LINKS{admin_root_path} . "/defs/Links.def";
my $DEBUG_GRAB=0;
print "Content-type: text/html\n\n" if ($DEBUG_GRAB);
my ($cat, $cat_r, $cat_ID, $get_link, $f_link, $output, $offset, $count);
$output = '';

## $get_link = $LINKDB->prepare (" SELECT * FROM Links WHERE CategoryID = ? AND is_Featured = 'Yes' LIMIT 1 "); ## prepare the select statement
$get_link = $LINKDB->prepare (" SELECT * FROM Links WHERE CategoryID = ? AND Priority = 'Yes' LIMIT 1 "); ## prepare the select statement
$get_link->execute ($cat_id); ## execute the select statement to find a featured link.
$f_link = $get_link->fetchrow_hashref || (); ## fetch the returned row, or assign an empty list

if (!$f_link) { ## if there are no featured links, pick a random one
print "There are no featured links <BR>\n" if ($DEBUG_GRAB);
print "The category ID we are checking is ...", $cat_id, "<BR>\n" if ($DEBUG_GRAB);
$get_link = $LINKDB->prepare ( "SELECT COUNT(*) FROM Links WHERE CategoryID = $cat_id"); ## gets all the links
$get_link->execute() or die $DBI::errstr;
$count = $get_link->fetchrow_array;
if ($count) {
print "COUNT IS .... ", $count,"<BR>\n" if ($DEBUG_GRAB);
($count == 1) ? $offset=0 : $offset = int rand ($count - 1) ;
print "The ofset value is .... ", $offset, "<BR>\n" if ($DEBUG_GRAB);
$get_link = $LINKDB->prepare ( " SELECT * FROM Links Where CategoryID = $cat_id LIMIT $offset, 1 ");
$get_link->execute() or die $DBI::errstr;
$f_link = $get_link->fetchrow_hashref;
print "F_LINK is...:", $f_link, "<BR>\n" if ($DEBUG_GRAB);
}
}
$cat = get_category_name($cat_id) ;
## $output .= "Today's Featured Link in <B>$cat</B> is: <BR>\n" if ($f_link); ## debugging flag, mainly
$output .= "Today's Featured Link is:\n" if ($f_link); ## debugging flag, mainly
($f_link) ? $output .= &site_html_link($f_link) : $output .= ''; ## if there are no links at all

return $output;
}
In site_html_print_cat, below the &load_template call, add:

defined $dynamic and $output .= &grab_featured_link ($cat_r->{ID}); ### testing, only with page.cgi though

That's all there is to this mod. It's pretty cool, and you can actually create a new routine, instead of &site_html_link to send the link to, to do custom "short" or "featured" formatting.


PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://postcards.com/FAQ