Page 1 of 1

Changing uploads template - smarty question

Posted: Sat Jul 15, 2006 2:25 pm
by boscopup
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:

Code: Select all

$extension = strtolower (strrchr ($entry->name, "."));
(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.

Re: Changing uploads template - smarty question

Posted: Tue Jul 18, 2006 1:11 am
by boscopup
Ok, I figured it out. If anyone else runs into this issue and is searching the forums, the answer is... parameters passed into the user defined tag.

So I call {get_extension name=$entry->name} and then my user defined tag uses $param['name'] in its code. That particular variable has anchor tags in it, just as an fyi. :)