[Typo3-dev] TMENU_LAYERS - bloat in my <HEAD> !

Simon Child simondt at gpuk.net
Mon Sep 1 22:02:59 CEST 2003


I'm using a TMENU_LAYERS menu. I thought a text based menu would give a
smaller page size (kb) than a graphical menu.

With only about 40 pages (so far) TMENU_LAYERS puts 28kb of script in the
HEAD of my document, and there is another 11kb immediately after the <BODY>
tag, before my content even starts, then the actual menu itself is another
4kb (fair enough).

43kb for a text based menu!! And I'm using css, not lots of font tags etc.
What happens if I have a couple of hundred pages on my site - 200kb for a
text menu?!

This could be improved. Whilst it is good practice to use meaningful names
for functions and labels, and to comment the code, the problem is that with
the TMENU_LAYERS menu there is a block of script generated, repeated once
for every page on the site, and stored in the head. But this means that the
comments are repeated 40 times, the long function names are repeated 80-120
times, and so on.

* Perhaps the live code in media/scripts/tmenu_layers.php should not have
comments in it. By all means have another commented file, stored in the same
directory, for reference.

* Similarly perhaps the function names could be much shorter. Again perhaps
the live code could have very brief names, and another file stores the links
to meaningful names. Perhaps GLV_curLayerWidth could become Gcw and
GLV_curLayerHeight becomes Gch, and so on.

I experimented with this, removing comments and renaming some (not all)
functions to such as G_cw G_ch, and changing AnchorID to AI, and so on (of
course I made matching alterations in
tslib/media/scripts/jsfunc.layermenu.js) and it made my page 9kb smaller.
But smaller still would be better...

Anyone any thoughts?

--
Simon Child








More information about the TYPO3-dev mailing list