eXtropia: the open web technology company
Technology | Support | Tutorials | Development | About Us | Users | Contact Us
Development resources
 ::   WebWare 2.1 (Perl)
 ::   WebWare 2.0 (Java)
 ::   Cool hacks
cool hack
Chat witn an icon next to username  
sent in the following hack...

I am sending this message regarding a slight modification (cool hack) to
your chat script.

I have learnt that Mr. Maarten Reumer has modified your chat script in
order to add an icon next to the username.
It is a nice work and I also enjoyed adding an icon next to the username
and appreciate his work and idea.

But the main thing is in chat-html.pl file which I have modified it a
In that file, in order to show all the icons, Mr. Maaren Reumer has used
table tag to show all the available icons.
As there are 40 icons (faces), He has written number of table tags in
chat-html.pl file  to achieve his goal.


<table border=1>
  <input type="radio" name="chat-http" value="1.gif">
  <img src="../images/faces/1.gif" align="absmiddle">

With his method, we have 140 lines of code to read/write because we
should create a 4x10 table and write an image tag
for each icon separately.

What I have done:

Step One:
I have renamed all the images in ascending order from 1 to 40.
e.g. 1.gif, 2.gif, 3.gif ... 40.gif

Step Two:
Have removed all the 140 lines (table tags) and replaced with the
following code:

$imgBase="../images/faces"; please point this address to your image
print "<table border=1>\n";
                print "<tr>\n";
                        print "<td><input type=\"radio\"
name=\"chat_http\" value=\"$i.gif\">\n";
                        print "<img src=\"$imgBase/$i.gif\"></td>\n";
                print "</tr>\n";
print "</table>\n";
print qq!

I think, by this method we can keep our script niter, simpler and the
main thing get ride of number of lines of codes which
in this case is about 140 lines!

What do you think? Are you agree with me?
Attached, I am sending a copy of modified chat-html.pl and a readme file
in zip format.
I would be grateful to have a reply from you and receive your feedback.
Get the script here!