[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]

Re: img-dimensions in navbars



On Mon, Nov 05, 2001 at 06:05:01PM +0100, Clemens Oertel wrote:
> hi,
> 
> to please poor ms ie users, i'd like to hardcode the sizes of my navbar's
> button images to speed up the site rendering. now i'm wondering: how do i do
> that with wml 2.0.8?
> 
> i tried adding
>   :img:width="123"     and
>   :img:height="321"
> for each of the navbar's images. however, none of the size specs appear in the
> generated html code (i've seen the :img:-option used only with navbar:render -
> doesn't it work with navbar:button?).
> 
> i know it's possible - ralf's site about wml seems to have it (but i couldn't
> find the source files for the navigation bars).
> 
> by the way, the image's width varies for each button.

Image dimensions are automatically added during pass 7, so if they are
not, there is something you forgot to mention.

About wml::des::navbar, your try looks fine and I must admit that I
forgot to implement all the necessary stuff, this patch should fix it.

-- 
Denis Barbier
WML Maintainer
Index: navbar.src
===================================================================
RCS file: /home/barbier/Projets/Wml/cvs/wml/wml_include/des/navbar.src,v
retrieving revision 1.43
diff -u -u -r1.43 navbar.src
--- navbar.src	2001/10/28 23:53:53	1.43
+++ navbar.src	2001/11/05 22:22:52
@@ -419,11 +419,14 @@
         my $target = ($B->{TARGET} eq '' ? $CFG->{TARGET} : $B->{TARGET});
         my $hint   = $B->{HINT};
         my $menu   = $B->{MENU};
-        my %extra_attr = %{$B->{TAG_ATTR}};
 
         my $idselect = ($select eq $id or ($select eq $alias and $alias ne '') ? 1 : 0);
         my $buttontype = 'N';
         $buttontype = ($subselected ? 'SS' : 'S') if $idselect;
+        my %extra_attr = (
+                a       => (${$B->{TAG_ATTR}}{'a'.$buttontype} || $tag_attr{'a'.$buttontype}),
+                img     => (${$B->{TAG_ATTR}}{'img'.$buttontype} || $tag_attr{'img'.$buttontype}),
+        );
 
         #
         #   PROLOG
@@ -507,7 +510,7 @@
                           qq# onfocus="self.status = '$hint'; return true"# .
                           qq# onblur="self.status = ''; return true"#;
                 }
-                $O .= '<*a href="'.$url.'"'.$target.$js.$tag_attr{'a'.$buttontype}.$extra_attr{'a'.$buttontype}.'>'.$txt.'<*/a>';
+                $O .= '<*a href="'.$url.'"'.$target.$js.$extra_attr{'a'}.'>'.$txt.'<*/a>';
             }
         }
         else {
@@ -517,7 +520,7 @@
             $hint = $txt if ($hint eq '');
             $hint = '' if $nohints;
             if (($idselect and not $subselected) or $url eq '') {
-                $O .= '<img src="'.$img[1].'" alt="'.$alt.'"'.$tag_attr{'img'.$buttontype}.' />';
+                $O .= '<img src="'.$img[1].'" alt="'.$alt.'"'.$extra_attr{'img'}.' />';
             }
             elsif ($idselect and $subselected) {
                 $js = '';
@@ -534,8 +537,8 @@
                           qq# onfocus="self.status = '$hint'; return true"# .
                           qq# onblur="self.status = ''; return true"#;
                 }
-                $O .= '<*a href="'.$url.'"'.$target.$js.$tag_attr{'a'.$buttontype}.'>' .
-                      '<img name="'.$nb.'_'.$id.'" src="'.$img[1].'" alt="'.$alt.'" border=0'.$tag_attr{'img'.$buttontype}.' />' .
+                $O .= '<*a href="'.$url.'"'.$target.$js.$extra_attr{'a'}.'>' .
+                      '<img name="'.$nb.'_'.$id.'" src="'.$img[1].'" alt="'.$alt.'" border=0'.$extra_attr{'img'}.' />' .
                       '<*/a>';
             }
             else { # not selected 
@@ -553,8 +556,8 @@
                           qq# onfocus="self.status = '$hint'; return true"# .
                           qq# onblur="self.status = ''; return true"#;
                 }
-                $O .= '<*a href="'.$url.'"'.$target.$js.$tag_attr{'a'.$buttontype}.'>' .
-                      '<img name="'.$nb.'_'.$id.'" src="'.$img[0].'" alt="'.$alt.'" border=0'.$tag_attr{'img'.$buttontype}.' />' .
+                $O .= '<*a href="'.$url.'"'.$target.$js.$extra_attr{'a'}.'>' .
+                      '<img name="'.$nb.'_'.$id.'" src="'.$img[0].'" alt="'.$alt.'" border=0'.$extra_attr{'img'}.' />' .
                       '<*/a>';
             }
         }