Gossamer Forum
Home : Products : Links 2.0 : Customization :

linked_title mod help

Quote Reply
linked_title mod help
okay this makes sense logically to a human (at least it makes sense to this human) but somehow its not makeing sense to the program LOL

basically i have three catigories which are supposed to be on the same level as the whole list in the title_linked navigation - dont ask why i dont make them all subcategories cuz i have to do it this way cuz its too late to redo everything subcategory wise :/

what i need is for the nav to look normal for all categories (ie home : regular category : link) except for these three which i need to look one level higher (ie special category : link )

sub build_linked_title {
# --------------------------------------------------------
# Returns a string of the current category broken up
# by section, with each part linked to the respective section.
my $input = shift;
my (@dirs, $dir, $output, $path, $last, @fields);
@dirs = split (/\//, $input);
$last = &build_clean(pop @dirs);

foreach $dir (@dirs) {
$path .= "/$dir";
$dir = &build_clean ($dir);
if (@fields[$db_main_category] = "Dollar_Trials") {
$output = qq| <A HREF="$build_root_url/Dollar_Trials">$1 Trials</A> :|;
}
elsif (@fields[$db_main_category] = "Cheap_Memberships") {
$output = qq| <A HREF="$build_root_url/Cheap_Memberships">Cheap Memberships</A> :|;
}
elsif (@fields[$db_main_category] = "High_Quality") {
$output = qq| <A HREF="$build_root_url/High_Quality">High Quality</A> :|;
}

else {
$output = qq| <A HREF="$build_root_url">Home</A> :|;
$output .= qq| <A HREF="$build_root_url$path/">$dir</A> :|;
}
}
$output .= " $last";

return $output;
}

anyone have any thoughts on what i am doing wrong here? im sure its something really stupid but i am not a programmer and i dont think anyone has asked for or posted a mod like this before... prolly cuz its a dumb way of doing it but im stuck Unsure




Vote Stinky
Quote Reply
Re: [security_man] linked_title mod help In reply to
a) "=" is an assignment operator, and always returns true...

Equality tests need to use either "eq" or "==". In this case, sinse you are comparing strings, you need to use "eq".

b) where did @fields come from? it doesn't exist in sub build_linked_title() in nph-build.cgi on my installation.

1) @fields, although initialized, is undefined. thus
2) @fields[$db_main_category] is also undefined, and lastly
3) @fields[$db_main_category] is an an array, not a string.

c) a little more information on what you are trying to acomplish would be nice.

as it is, simply changing build_linked_title() does not affect the positions of those categories in the actual category lists. is your end goal only to alias the locations of those categories in the breadcrumb trail? Do those "special" categories have subcategories?

Philip
------------------
Limecat is not pleased.

Last edited by:

fuzzy logic: Mar 4, 2004, 11:34 PM
Quote Reply
Re: [fuzzy logic] linked_title mod help In reply to
okay that was odd - half my post got eaten... lemme try this again

In Reply To:
as it is, simply changing build_linked_title() does not affect the positions of those categories in the actual category lists. is your end goal only to alias the locations of those categories in the breadcrumb trail? Do those "special" categories have subcategories?


yes thats exactly what i was wanting to do - i dont need the category list on home.html to chage just the breadcrumb trail.

my biggest problem was the = instead of the eq... no wonder no matter what the qualifier was in that if statement it always came back true LOL

as to the other question about @fields... thats what happens when someone who doesnt know what they are doing starts jacking around with this script Blush i was following the logic of the menu mod which i already have working:

sub menu {
# --------------------------------------------------------
#
my (%c, @fields);
open (DB, "<$db_category_name") or &cgierr("unable to open $db_file_name. Reason: $!");
if ($db_use_flock) { flock(DB, 1); }
LINE: while (<DB>) {
(/^#/) and next LINE;
(/^\s*$/) and next LINE;
@fields = &split_decode ($_);
next LINE if (@fields[$db_main_category] =~ "Dollar_Trials");
next LINE if (@fields[$db_main_category] =~ "Cheap_Memberships");
next LINE if (@fields[$db_main_category] =~ "High_Quality");

$c{$fields[$db_main_category]}++;
}
close DB;
foreach $field (sort keys %c) {
if ($field =~ m,^([^/]*)$,) {
$field2 = &build_clean($field);
$category_list .= qq|<a href= "$build_root_url/$field"><font color="#FFFFFF">$field2</font></a><br>
|;
}
}
return $category_list;
}

which is in db_utils.pl. I guess i was hopeing that i could cut and paste with a little bit of if thans thrown in and it would magically work. Thanks for helpin a poor script moron like me, this stuff really does make what little brain i have ooze out my ear Blush




Vote Stinky

Last edited by:

security_man: Mar 5, 2004, 5:15 AM