Changing uploads template - smarty question
Posted: Sat Jul 15, 2006 2:25 pm
This is probably really really really simple, but I'm not very proficient in smarty yet, so I haven't been able to figure this out. 
In the Uploads module's Summary template, I would like to place a pdf image if the file is a pdf, and a Word doc image if the file is a doc, etc. I know how to do that once I get the extension. The problem I'm having is... How do I get the extension? I know that somehow, I can use this code to get it:
(borrowed from the module code itself)
But how do I use that code in my template so that I'll have use of the $extension variable? I tried making a user defined tag with that code, but that didn't work. So I imagine I probably need some other smarty syntax that I can't seem to find.

In the Uploads module's Summary template, I would like to place a pdf image if the file is a pdf, and a Word doc image if the file is a doc, etc. I know how to do that once I get the extension. The problem I'm having is... How do I get the extension? I know that somehow, I can use this code to get it:
Code: Select all
$extension = strtolower (strrchr ($entry->name, "."));
But how do I use that code in my template so that I'll have use of the $extension variable? I tried making a user defined tag with that code, but that didn't work. So I imagine I probably need some other smarty syntax that I can't seem to find.