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

Re: rollover and slice



On Wed, 28 Jul 1999, Jan Ulrich Hasecke wrote:

> Hello,
> 
> I have a strange problem and cannot solve it.
> 
> I have this definition in my template
> 
> # Slice 1
> <lang:new id=free short>
> 
> # Slice 2
> <lang:new id=bk short>
> 
> <bk> 
> <rollover name="logo"  
> href="Kontakt.html" 
> src="../GIFS/seitenlogoa2.gif"  
> oversrc="../GIFS/seitenlogob.gif" 
> alt="Kontakt" > 
> </bk>
> 
> <free> 
> <rollover name="logo"  
> href="Kontakt.html" 
> src="../GIFS/seitenlogoa1.gif"  
> oversrc="../GIFS/seitenlogob.gif" 
> alt="Kontakt" >
> </free>
> 
> The first slice, in this case <bk> is okay. But the second is
> corrupt. When I change the succession, and <free> is the first,
> then <bk>, now the second, is corrupt and the first <free> is
> okay.
> 
> The same result with [LANG_BK:...:] and LANG_FREE:...:]
> 
> In the second slice the first part of the script 
> 
> function ro_imgNormal(imgName) {     (and so on)
> 
> is gone.
> 
> Any hint?

Hi Jan Ulrich,

If you have 20 buttons with rollover, you don't want to insert 20
definitions of the ro_imgNormal and ro_imgOver routines.
So they are written only once.

You have to ensure that the first call to <rollover> is _not_ in any
slice. I see 2 solutions:
1) use an invisible rollover with 1x1 images at the beginning of your
   text
     #use wml::des::imgdot
     <rollover name="hidden" href="#" alt=""
               src="<imgdot>" oversrc="<imgdot>">

2) write slices inside rollover
     <rollover name="logo" href="Kontakt.html" alt="Kontakt"
               src="../GIFS/seitenlogoa<protect pass=3><bk>2</bk><free>1</free></protect>.gif"
               oversrc="../GIFS/seitenlogob.gif"
     >
Really clear, isn't it ;-)
The <protect> trick is because slices are expanded to
   [LANG_BK:2:][LANG_FREE:1:]
and ePerl uses colon as a delimiter in the internals of rollover.wml ;
the protection suppresses the expansion above during the pass 3.

The (1) is simpler in this case, but you should also have (2) in mind,
it's more general. Its drawback is that image dimensions cannot be
checked during pass 7. One workaround is to write an epilog filter

prompt$ cat epilog
#! /bin/sh
path/to/lib/wml/exec/wml_p7_htmlfix $1 > $1.tmp && mv $1.tmp $1
prompt$ cat .wmlrc
  -E /path/to/epilog
prompt$ chmod a+x epilog

-- 
Denis Barbier
WML Maintainer


______________________________________________________________________
Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com