change icon

Seems like a simple question but …

My tree xml is built up in PHP. Now automatically the items containing subitems will get the folder icons and items without subitem get the leaf.gif icon. I want this last one to be changed to the folderClosed icon.
Hopefully this can be done within the PHP routine. I don’t like to have it done in the clients browser.

Can someone tell me where the attributes im0,im1,im2 come into play ? Changed the icons for these attributes but to no avail.

Thanx

im0 - Image of item - “leaf item” ( 18x18px by default ), if missed default image from applied skin will be used
im1 - Image of item - “folder in open state” ( 18x18px by default ), if missed default image from applied skin will be used
im2 - Image of item - “folder in closed state” ( 18x18px by default ), if missed default image from applied skin will be used