Changing uploads template - smarty question

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
boscopup
Forum Members
Forum Members
Posts: 35
Joined: Wed May 04, 2005 3:48 pm

Changing uploads template - smarty question

Post 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.
boscopup
Forum Members
Forum Members
Posts: 35
Joined: Wed May 04, 2005 3:48 pm

Re: Changing uploads template - smarty question

Post 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. :)
Post Reply

Return to “Modules/Add-Ons”