[ic] Vertical Category List Question

Ed LaFrance edl at newmediaems.com
Wed Nov 12 09:46:38 EST 2003


At 02:47 AM 11/12/2003 -0600, you wrote:
>Hello List Members,
>This is just a no-brainer for most of you, I'm sure.  Since I seem to be
>without my brain at the moment, I'm hoping someone can just enlighten me
>regarding the design of the vertical category list.
>
>Here's what I want to do using the vertical category menu on the left:
>____________________________________
>Product Group (links to a page) => Bold Text
>--category (links to a page) => Normal Text
>
>Product Group (links to a page) => Bold Text
>--category (links to a page) => Normal Text
>____________________________________
>
>Because I am hyperlinking the Product Group headings, I'm having difficulty
>understanding how to make them Bold Text, since they are being controlled by
>the same .class as the categories in the __THEME_CSS__ , as shown below:
>}
>
>A.barlink:link, A.barlink:active, A.barlink:visited {
>   color: __CATEGORYBAR_LINK__;
>   font-family: __CATEGORYBAR_FONT__;
>   font-weight: __CATEGORYBAR_WEIGHT__;
>   text-decoration: __CATEGORYBAR_LINKDECO__;
>   font-size: __CATEGORYBAR_FONTSIZE__;
>}
>
>A.barlink:hover {
>   color: __CATEGORYBAR_LINKHOVER__;
>   font-family: __CATEGORYBAR_FONT__;
>   font-weight: __CATEGORYBAR_WEIGHT__;
>   text-decoration: __CATEGORYBAR_HOVERDECO__;
>   font-size: __CATEGORYBAR_FONTSIZE__;
>}
>
>The vertical category component offers this for the category list:
><tr>
>     <td valign="top" class="categorybar">
>       <b>[box-exec bar_link]area[/box-exec]</b>
>     </td>
>   </tr>
>   <tr>
>     <td valign="top" class="categorybar">
>----------------------------------------------------------
>I know if I  *don't*  hyperlink the Product Group headers, I can do anything
>I like with the font for that area using the __THEME_CSS__.  Can someone
>suggest how to make the Product Group headers bold AND hyperlinked while
>keeping the category headers normal weight and hyperlinked?
>
>Best regards,
>Michael G.

Take a look at the bar_link subroutine that is defined in 
VENDROOT/catalog_before.cfg; you'll see that the href is constructed near 
the bottom of the routine, and that is where the class for the same is 
called out.

I'd think you could just add a new CSS definiton for the other link 
appearance you want to use, and then just add some if logic to choose one 
or the other for the href, determined by the value of $base (which 
essentially tells you if this is a link against the area or cat tables). 
For instance, if you want to use barlink for categories, and new class 
called grouplink for product groups:

Sub <<EOR
sub bar_link {
         my $base = shift || 'cat';
         my $extra;

         ### NEW STUFF ###
         ### define a var for the CSS class for links...
         my $link_css;

         $base =~ s/(\W.*)//s
                 and $extra = $1;
         my $ref = shift;
         my $code = $ref->[0];

         my $record =  tag_data($base, 'n/a', $code, { hash => 1 });
         return $ref->[0] unless $record;

         my $url;
         my $anchor;
         my $highlight;
         my $first;
         my $expand;

         LINK: {
                 if($record->{link_type} eq 'external') {
                         $first = $record->{url};
                         $first =~ s/\s+$//;
                         $first =~ s/^\s+//;
                         $url = $first;
                 }
                 elsif   ($record->{link_type} eq 'internal') {
                         my ($page, $form) = split /\s+/, $record->{url}, 2;
                         my $current = $Tag->var('MV_PAGE', 1);
             $highlight = 1 if   $page eq $current
                                     or
                                 $page eq $CGI->{ui_explode};
                         $url = $Tag->area( { href => $page, form => $form });
                 }
                 elsif   ($record->{link_type} eq 'simple') {
                         my (@items) = split /\s*[\n,]\s*/, 
$record->{selector};
                         my @out;
                         my $fi = $record->{tab};
                         my $sp = $record->{page};
                         my %options = (
                                 href => 'scan',
                         );
                         push @out, "fi=$fi" if $fi;
                         push @out, "sp=$sp" if $sp;
                         push @out, "st=db";
                         if(! @items) {
                                 push @out, "ra=yes";
                                 $options{arg} = join "\n", @out;
                                 $url = $Tag->area(\%options);
                                 last LINK;
                         }
                         push @out, "co=yes";
                         for(@items) {
                                 my ($col, $string) = split /\s*=\s*/;
                                 push @out, "sf=$col";
                                 push @out, "se=$string";
                         }
                         push @out, $record->{search}
                                 if $record->{search} =~ /^\s*\w\w=/;

                         push @out, 
qq{va=banner_image=$record->{banner_image}} if ($record->{banner_image});
                         push @out, 
qq{va=banner_text=$record->{banner_text}} if ($record->{banner_text});
                         $options{arg} = join "\n", @out;
                         $url = $Tag->area(\%options);
                 }
                 elsif   ($record->{link_type} eq 'complex') {
                         $record->{search} =~ s/[\r\n+]/\n/g;
                         $record->{search} .= 
qq{\nva=banner_text=$record->{banner_text}} if ($record->{banner_text});
                         $record->{search} .= 
qq{\nva=banner_image=$record->{banner_image}} if ($record->{banner_image});
                         $url = $Tag->area('scan', $record->{search});
                 }
                 else {
                         $url = "";
                 }
         }

         ANCHOR: {
                 my $display_text = $record->{banner_text} || $record->{name};
                 $display_text =~ s/"/&quot;/g;
                 if($record->{display_type} eq 'url') {
                         $anchor = "";
                 }
                 elsif ($record->{display_type} eq 'name') {
                         $anchor = $display_text;
                 }
                 elsif ($record->{display_type} eq 'icon') {
                         $anchor = qq{<img src="$record->{image}" 
alt="$display_text"};
                         $anchor .= " $record->{image_prop}"
                                 if $record->{image_prop};
                         $anchor .= '>';
                         $anchor .= $display_text;
                 }
                 elsif ($record->{display_type} eq 'image') {
                         $anchor = qq{<img src="$record->{image}" 
alt="$display_text"};
                         $anchor .= " $record->{image_prop}"
                                 if $record->{image_prop};
                         $anchor .= '>';
                 }
                 else {
                         $anchor = $display_text;
                 }
         }
         return $url if ! $anchor;
         return $anchor if ! $url;
         EXPAND: {
                 if ($url =~ /\?/) {
                         $expand = "&expand=$code";
                 }
                 else {
                         $expand = "?expand=$code";
                 }
         }

         ### NEW STUFF ###
         ### set the CSS class to use....

         if ( $base eq 'cat' ) {
                 $link_css = 'barlink';
         }
         else {
                 $link_css = 'grouplink';
         }

         my $tmpl = $record->{link_template}
                         || $extra
                         || $Variable->{BAR_LINK_TEMPLATE}
                         || q{<A HREF="$URL$" class=barlink>$ANCHOR$</A>};
         $record->{ANCHOR} = $anchor;
         $record->{EXPAND} = $expand;
         $record->{URL} = $url;
         $tmpl =~ s!{HIGHLIGHT}(.*?){/HIGHLIGHT}! $highlight ? $1 : '' !gise;
         $tmpl =~ s/\$(\w+)\$/$record->{$1}/g;
         return $tmpl;
}
EOR


===============================================================
New Media E.M.S.              Technology Solutions for Business
11630 Fair Oaks Blvd., #250   eCommerce | Consulting | Hosting
Fair Oaks, CA  95628          edl at newmediaems.com
(916) 961-0446                http://www.newmediaems.com
(866) 519-4680 Toll-Free      (916) 961-0447 Fax
=============================================================== 



More information about the interchange-users mailing list