I don' know that this is exactly what you are looking for, but it might work. . I needed a way to dynamically create web buttons for a web based application I am creating. I created a script that takes a number of parameters to create dynamic consistent looking web buttons on the fly. Pass your text, icon, a set of 3 background images, along with a few other config options, and get buttons like these.
http://www.phpwebscripting.com/scripts/button/button.php?bl=bl_green.png&br=br_green.png&bg=bg_green.png&ico=group_key.png&ft=default.ttf&txt=Dynamically%20created&bsln=3&fcr=102&fcg=255&fcb=165&fs=10&ind=2
The buttons shown above were created using the demo of the script. Read the tutorial and try the demo at http://www.phpwebscripting.com/index.php?module=article&view=8
I hope this is useful