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

New macro for making boxes.



Hei!

Well, I am back from holidays and I began again to fiddle with my web
page. As return I add a gift.

I was working in an alternative way of creating boxes. The <box>
works fine, but I dislike it using the `gd'. I made an alternative
version, named <xbox> that uses simply tables. I think it looks cool
and it is faster (no Perl executed for using it).

Here you have an example:

<xbox 
 bgcolor="#ffffff"
 fgcolor="#000000"
 bdcolor="#3366ff"
 hdcolor="#ffffff"
 width="100%"
 bdwith="1"
 header="This is a Test Box">

 This Box can contain text, any kind of text
 Just write here what you like.
        

</xbox> 

The resulting code is:

<table cellspacing="0" cellpadding="1" width="100%" bgcolor="#3366ff" border="0">
<tr>
<td><font color="#ffffff">This is a Test Box
</font></td></tr>
<tr>
<td>
<table bgcolor="#ffffff" width="100%" cellspacing="0" cellpadding="4" border="0">
<tr>
<td><font color="#000000">
 This Box can contain text, any kind of text
 Just write here what you like.
</font></td>
</tr>
</table>
</td>
</tr>
</table>

The macro is here:




##
##  xbox - Easily Create Rectangular Box
##

#use wml::std::tags

<define-container xbox>
<preserve bgcolor>
<preserve fgcolor>
<preserve bdcolor>
<preserve hdcolor>
<preserve bdwidth>
<preserve bdspace>
<preserve width>
<preserve header>
<set-var %attributes>
<ifeq "<get-var header>" "" <prog
#
#  The standard box created via just two nested tables
#
<ifeq "<get-var bdwidth>" "" <set-var bdwidth=1>>
<ifeq "<get-var bdspace>" "" <set-var bdspace=4>>
<if <get-var bdcolor> <prog
<table cellspacing=0 cellpadding=<get-var bdwidth> \
       bgcolor="<get-var bdcolor>" border=0>
<tr>
<td>\
>>
<table <if <get-var bgcolor> "bgcolor=\"<get-var bgcolor>\""> \
       <if <get-var width> "width=\"<get-var width>\""> \
       cellspacing=0 cellpadding=<get-var bdspace> \
       border=0>
<tr>
<td>\
<if <get-var fgcolor> "<font color=\"<get-var fgcolor>\">">\
%body\
<if <get-var fgcolor> "</font>">\
</td>
</tr>
</table>
<if <get-var bdcolor> <prog
</td>
</tr>
</table>
>>
>
<prog
#
#  The headlined box created via one table and space GIFs
#
<ifeq "<get-var bdcolor>" "" <set-var bdcolor="#000000">>
<ifeq "<get-var bdspace>" "" <set-var bdspace=4>>
<ifeq "<get-var bdwidth>" "" <set-var bdwidth=1>>
<ifeq "<get-var bdspace>" "" <set-var bdspace=4>>
<ifeq "<get-var hdcolor>" "" <set-var hdcolor="#ffffff">>
<if <get-var bdcolor> <prog
<table cellspacing=0 cellpadding=<get-var bdwidth> \
   <if <get-var width> "width=\"<get-var width>\""> \
       bgcolor="<get-var bdcolor>" border=0>
<tr>
<td>\
<if <get-var hdcolor> "<font color=\"<get-var hdcolor>\">">\
<get-var header>
<if <get-var hdcolor> "</font>">\
</td>\
</tr>
<tr>
<td>\
>>
<table <if <get-var bgcolor> "bgcolor=\"<get-var bgcolor>\""> \
       <if <get-var width> "width=\"<get-var width>\""> \
       cellspacing=0 cellpadding=<get-var bdspace> \
       border=0>
<tr>
<td>\
<if <get-var fgcolor> "<font color=\"<get-var fgcolor>\">">\
%body\
<if <get-var fgcolor> "</font>">\
</td>
</tr>
</table>
<if <get-var bdcolor> <prog
</td>
</tr>
</table>
>>
>
>

<restore header>
<restore width>
<restore bdspace>
<restore bdwidth>
<restore bdcolor>
<restore fgcolor>
<restore bgcolor>
</define-container>

##EOF##

-- 
Saudos:
><ose        xmanoel@bigfoot.com   (Vigo/Galicia/Espaņa)
         http://pagina.de/xmanoel/
         http://w3.to/mikkeli/

09/14	Francis Scott Key writes words to "Star Spangled Banner", 1814
______________________________________________________________________
Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com