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

Yahoo style subcategories (@)

Quote Reply
Yahoo style subcategories (@)
Is there a mod which will allow one to have a subcategory listed under an alternate main category? They appear in Yahoo listings as subcategory (@).

If I have not been clear, see the following URLs for an example of what I mean.

http://www.yahoo.com
Quote Reply
Re: Yahoo style subcategories (@) In reply to
I think that is the "related" category option
on the admin screen. You see them as "related" categories, not with the @ sign, but it does accomplish the same stuff.

If what you mean is listing the subcategories under the the main category, there have been several alternatives posted for doing it, and I think Jerry is still working on polishing up the SQL version of the Links 2.0 mod.

------------------
POSTCARDS.COM -- Everything Postcards on the Internet www.postcards.com
LinkSQL FAQ: www.postcards.com/FAQ/LinkSQL/







Quote Reply
Re: Yahoo style subcategories (@) In reply to
i did this.... in links sql 1.02

it should be similiar though..

Code:
($id, $name, $new, $links, $description) = @{$subcat->{$cat}};
($name =~ m,.*/([^/]+)$,) ? ($category_name = $1) : ($category_name = $name);
if ($name =~ m,\@$,) {
my $CATDB = new Links: BSQL "$LINKS{admin_root_path}/defs/Category.def";
my $sth = $CATDB->prepare ( qq! SELECT ID, Name, Has_New_Links, Number_Of_Links, Description FROM Category WHERE Name = "$description" !) or die $DBI::errstr;
$sth->execute() or die $DBI::errstr;
($id, $name, $new, $links, $description) = $sth->fetchrow_array;
chop $category_name;
}
$category_url = $LINKS{build_root_url} . "/" . &build_clean_name($name) . "/";

and in nphbuild.cgi in build_category_pages you have to say Where Name NOT LIKE '%@'

jerry
Quote Reply
Re: Yahoo style subcategories (@) In reply to
Hi Jerry

The Mister could find out the one where exactly I place the codes and how to do to add a category with the @ in front with link for another category?

------------------
By Jćnio
Quote Reply
Re: Yahoo style subcategories (@) In reply to
Jerry, I tried to follow the code, but I've gotta be missing something.

You want to have an "@" appear in the HREF tag with the category name, but not in the URL... wouldn't that be just a modification of the template for outputting the related category list? (It's hardcoded in the source file, but it's still a template).

In nph_build sub build_category_page

Code:
# Calculate the related entries and put in a <LI> list.
$get_related->execute($OUT{category_id});
$OUT{related} = '';
while (($name) = $get_related->fetchrow_array) {
$OUT{related} .= qq|<li><a href="$LINKS{build_root_url}/|;
$OUT{related} .= &build_clean_name ($name);
$OUT{related} .= qq|/$LINKS{build_index}">$name</a></li>|;
}

Where it says:

Code:
$OUT{related} .= qq|/$LINKS{build_index}">$name</a></li>|;

change that to

Code:
$OUT{related} .= qq|/$LINKS{build_index}">@ $name</a></li>|;


As I said, I'm either missing something really big...

------------------
POSTCARDS.COM -- Everything Postcards on the Internet www.postcards.com
LinkSQL FAQ: www.postcards.com/FAQ/LinkSQL/







Quote Reply
Re: Yahoo style subcategories (@) In reply to
this has nothing to do with relations pugdog.. Smile

i haven't modded 1.11 to do this.. so i might as well do it now...

in site_html_print_cat

add:

Code:
my $db = new Links::DBSQL "$LINKS{admin_root_path}/defs/Category.def";
my $sth = $db->prepare ("SELECT ID, Name, Has_New_Links, Number_Of_Links, Description FROM Category WHERE Name = ?");

above:

Code:
# Print Header.

change:

Code:
# Get the URL and the Category name.
$category_url = $LINKS{build_root_url} . "/" . &build_clean_name ($cat_r->{Name}) . "/";
($cat_r->{Name} =~ m,.*/([^/]+)$,) ? ($category_name = $1) : ($category_name = $cat_r->{Name});
$cat_r->{Short_Name} = $category_name;
$cat_r->{URL} = $category_url;

to:

Code:
$cat_r = $subcat->{$cat};
($cat_r->{Name} =~ m,.*/([^/]+)$,) ? ($category_name = $1) : ($category_name = $cat_r->{Name});
if ($cat_r->{Name} =~ m,\@$,) {
$sth->execute($cat_r->{Description}) or die $DBI::errstr;
$cat_r = $sth->fetchrow_hashref;
chop $category_name;
}
$cat_r->{Short_Name} = $category_name;
$cat_r->{URL} = $LINKS{build_root_url} . "/" . &build_clean_name($cat_r->{Name}) . "/";

remove the bolded if you want the alias categories to actually have the @ sign at the end... i took it out..

plus.. you have to change the validation for Name in the Category table..

well... i guess this is only for people that use the english language.. or maybe not. anyway.. change it to:

^[\w\d/_-]+\@?$

if you want.. i'm not.. Smile

anyways.. to use.. just make a category that ends with @.. in the categories description.. you want to put the name of the category you are linking to.. like for example.. i want Software/Games/Handheld

to link to

Hardware/Games

i make..

Name: Software/Games/Handheld@
Description: Hardware/Games

additional things to put in nph-build.cgi..

in build_category_pages..

under

Code:
$category_r = $CATDB->array_to_hash ($category_r);

add:

Code:
next if ($category_r->{'Name'} =~ m,\@$,);

there was an easier way to do this.. but it was in Links SQL 1.02 when that query was still plain text.. not a DBSQL query.. but this way seems to go faster.. ?? Smile

you might want to add something to build_stats too..

like "AND NAME NOT LIKE '%@'"

but i don't know about that..

jerry

[This message has been edited by widgetz (edited December 30, 1999).]
Quote Reply
Re: Yahoo style subcategories (@) In reply to
that took me forever... Smile

http://www.pdamania.com/index.html

look at category "Test"

lame.. i know.. Smile

jerry
Quote Reply
Re: Yahoo style subcategories (@) In reply to
The link says "not open"

I wanted to see what I was missing... since at dmoz.org the '@' categories are just related categories and basically quick link to them.



------------------
POSTCARDS.COM -- Everything Postcards on the Internet www.postcards.com
LinkSQL FAQ: www.postcards.com/FAQ/LinkSQL/







Quote Reply
Re: Yahoo style subcategories (@) In reply to
this is yahoo style..

when you add index.html it will display the page.. i put

DirectoryIndex /temp.html

in my root dir Smile

jerry
Quote Reply
Re: Yahoo style subcategories (@) In reply to
All that is is mixing the subcategories
in with the related categories, and putting
the @ at the end of the related link?

I know I'm still missing something... Smile
Quote Reply
Re: Yahoo style subcategories (@) In reply to
exactly.. haven't you ever seen yahoo.. whereever they have a category that can be equal to another category.. they do this..

hmm.. let me think of a good one..

ok.. Art/3D/Computer Graphics (not real)

can have a fake category (alias) from

Computers/Multimedia/Computer Graphics

or something..

go look in yahoo.. find a category that ends up in a whole other category with the same name.. usually marked with an @

jerry
Quote Reply
Re: Yahoo style subcategories (@) In reply to
teste (Unkown Tag: Number_of_Links)

Jerry the one what can wrong be?

it is where he should appear the amount of links...

how did we solve that?
Quote Reply
Re: Yahoo style subcategories (@) In reply to
Jerry the mod works perfect, only that doesn't appear the @ in the end of the name of the category and him it doesn't eliminate the tag qie it shows the amount of links and it doesn't also recognize the same.

Please tell me a form of solving this small bug in this mod....
PS: It would like that appeared the symbol of @ in the end of the name of the category.
Quote Reply
Re: Yahoo style subcategories (@) In reply to
WidGetz Help please!
Quote Reply
Re: Yahoo style subcategories (@) In reply to
Hi Jerry..
Could it help me with a solution for this mistake?
how do I do for this mod to work correctly in Links 1.11?

I thank your collaboration...

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-=-=-=-= By Jānio -=-=-=-=-=-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Quote Reply
Re: Yahoo style subcategories (@) In reply to
remove

Code:
$cat_r->{Short_Name} = $category_name;

i put that in the instructions...

jerry
Quote Reply
Re: Yahoo style subcategories (@) In reply to
Ok I remove that line and the problem is larger:

appears this in the place of the names of the categories:

Unkown Tag: Short_Name (837)
Unkown Tag: Short_Name (17178)
Unkown Tag: Short_Name (1442)
Unkown Tag: Short_Name (8150)

Quote Reply
Re: Yahoo style subcategories (@) In reply to
Jerry Su you could see for me the one where the mistake is?

Or to post all the configuration for links 1.11 step the step?


Thank you

Jānio
Quote Reply
Re: Yahoo style subcategories (@) In reply to
A solution for the problem: (Unkown Tag: Number_of_Links)
Where it goes:
Code:
my $sth = $db->prepare ("SELECT ID, Name, Has_New_Links, Number_Of_Links, Description FROM Category WHERE Name = ?");


To substitute for:
Code:
my $sth = $db->prepare ("SELECT * WHERE Name = ?");

Quote Reply
Re: Yahoo style subcategories (@) In reply to
Now still we have another Problem:

In the search when showing the categories appears the link of the category with the @ but her URL is it of her same and not the one of the link which she belongs...

In doubts click in the link below and prove,

http://busca.brlink.com.br/Busca/?query=janio

Jerry you have some alternative for that mistake?

-=-=-=-=-=-=-=-=-=
-=-= By Jānio -=-=
-=-=-=-=-=-=-=-=-=
Quote Reply
Re: Yahoo style subcategories (@) In reply to
Robert reason insists on always recommending you the mode of related categories? being that if to use one link@ would be more useful, therefore thus we could only make one link@ in subcategory that it was necessary.

-=-=-=

Jerry Su has you some alternative for this mod to function with version 1,13?

-=-=-=-=-=-=-=-=-
LinksSQL User
-=-=-=-=-=-=-=-=
Quote Reply
Re: Yahoo style subcategories (@) In reply to
There is a way to do the Yahoo (@) Style category jumping, see the following thread:

http://www.gossamer-threads.com/...ew=&sb=&vc=1

All the best
Shaun