Gossamer Forum
Home : Products : Links 2.0 : Customization :

Category Display on New Page

Quote Reply
Category Display on New Page
Hi,

I would like the category display on the new page to show just the last category:
so:
Category : Sub Category : Last Category
will look like:
Last Category

Now here is where this is different from some of the other posts. I have a field in my category DB that I named MerchName, that has the text I would like to display for the Last Category.

So I thought perhaps I can modify the following line from the sub build_new_page in my nph-build.cgi:
$link_results .= qq|<P><b><font face='Arial' size='2'><A HREF="$build_root_url/$category/$build_index">$category_clean</A></font></b>\n|;

and insted of using $category_clean, I can use $MerchName. I have tried this and the category name simply dissappeared, so I am missing something.

If anyone knows how to accomplish this, it would be great!

Thanks
George
Quote Reply
Re: [macbethgr] Category Display on New Page In reply to
One more thing.... If I can find where category_clean is configured, maybe I can figure this out..... Any help would be greatly appriciated!!!
Quote Reply
Re: [macbethgr] Category Display on New Page In reply to
Hi! I might not be the best one to answer your questions, but at least you'll have an answer! look in db_utils.pl, you'll see this:

Code:
sub build_clean {
# --------------------------------------------------------
# Formats a category name for displaying.
#
my ($input) = shift;
$input =~ s/_/ /g; # Change '_' to spaces.
$input =~ s,/, : ,g; # Change '/' to ' : '.
return $input;
}


All that does is remove spaces and slashes; "clean." If you have added a new field to the cat listing, and done it properly, seems to me you could remove the <%linked title%> and replace it with <%merchname%> or whatever you created. Maybe not, could be more complicated...

Good luck!Unimpressed


Leonard
aka PerlFlunkie

Last edited by:

PerlFlunkie: Nov 7, 2002, 1:31 PM
Quote Reply
Re: [PerlFlunkie] Category Display on New Page In reply to
Thanks.... What I am looking for is to use the text of another data field in place of $category_clean for the category groupings on the what's new page. I still want it to link to the same place and I still want to be able to use $category_clean elsewhere.

I think what I may be missing is defining $MerchName, so I'll try adding this line to the sub build_new_page in my nph-build.cgi::
my $MerchName = $rec{'MerchName'};

and changing this line:
$link_results .= qq|<P><b><font face='Arial' size='2'><A HREF="$build_root_url/$category/$build_index">$category_clean</A></font></b>\n|;

to:
$link_results .= qq|<P><b><font face='Arial' size='2'><A HREF="$build_root_url/$category/$build_index">$MerchName</A></font></b>\n|;

I'll let everyone know if it works...

George

Last edited by:

macbethgr: Nov 8, 2002, 3:16 AM
Quote Reply
Re: [macbethgr] Category Display on New Page In reply to
No, that did not work either..... But this did.... even though I am not using the feild I created, I am at least displaying only the last category.

Add this to your nph-build.cgi:

sub build_last_title {
# --------------------------------------------------------
# Returns a string of the current category broken up
# by section, with the last part to the respective section.
# copy of build_linked_title


my $input = shift;
my (@dirs, $dir, $output, $path, $last);


@dirs = split (/\//, $input);
$last = &build_clean(pop @dirs);


$output = qq||;
foreach $dir (@dirs) {
$path .= "/$dir";
$dir = &build_clean ($dir);
$output .= qq||;
}
$output .= " $last";


return $output;
}


Then in the sub build_new_page, change the following line:
$category_clean = &build_clean ($category);
to:
$category_clean = &build_last_title ($category);

And it worked!

George

Last edited by:

macbethgr: Nov 8, 2002, 7:19 AM