[Zope] Add icons for msword or pdf documents in dtml-tree?

Greg sysman@techgroupinc.com
Tue, 12 Nov 2002 11:10:44 -0800


I did some searching and found some info on Zproducts and Zclasses.  Is 
that what it takes to add an icon to a specific content-type?  I found a 
How-To a few months back about adding icons in your tree tag, but I can 
find it anywhere now.  (I should have printed it when I saw it!)

When I add documents to a folder, they are added as meta-type: file.  Is 
there an easy way to associate the icon to the content-type?  Or, is it 
easier to just add the dtml-if statements for each image source I have?

This is what I have now:
<dtml-tree Public branches="objectValues" sort="title">
   <dtml-if "meta_type=='Folder'">
      <IMG SRC="<dtml-var icon>" BORDER=0> <b><font 
style="font-size:10pt;"><dtml-var title></font> </b>
   <dtml-else>
       <dtml-if "title == 'Index' or title == 'User Folder'">
       <dtml-else>
         <A HREF="<dtml-var tree-item-url>" target="_new">
         <IMG SRC="<dtml-var icon>" BORDER=0> <dtml-var title></A> - I 
am a <dtml-var content_type> document.
       </dtml-if>
   </dtml-if>
</dtml-tree>

I would like this, <IMG SRC="<dtml-var icon>" BORDER=0> , to show the 
icon of MSWord, or an Acrobat Icon for PDF.  I could do it like this:

<IMG SRC="<dtml-if "content-type == 'application/msword"><dtml-var 
msword.gif><dtml-else><dtml-var icon></dtml-if>" BORDER=0>

That just seams like a lot of work if you have several content-types. 
 If you can point me in the right direction, I would appreciate it. 
 (or, just say I am screwed, just type out the code!)

Thanks a bunch!  Greg