tags:

views:

30

answers:

2
+1  Q: 

TabInfo IconFile

I'm wondering how to correctly use the IconFile property of a TabInfo object in DotNetNuke? I am building a custom overlay menu that will be displaying the tab name, description, and an icon similar to the Admin and Host pages that use the 'console' DesktopModule. If I have a TabInfo object that has an IconFile set for it the value of the IconFile field is something like 'FileID=83'. I'm assuming this needs to be run through some sort of File API to determine what the URL of the file is.

A: 

DotNetNuke.Services.FileSystem.FileController has a method called GetFileById that accepts a File ID and a Portal ID. This returns a type of FileInfo which has both PhysicalPath and RelativePath properties.

Ian Robinson
You are correct about the GetFileById method of the FileController. This works beautifully to return a FileInfo object when you know the FileID. However, my the original intent of my question was to figure out how to use the IconFile property. I was incorrect in thinking that it returned the FileID. The DB record contains the FileID, but the object instance returns the actual file name. This filename simply has to be prefaced with the PortalSettings.HomeDirectory to get the file.
Yobi21
+1  A: 

The IconFile property of the TabInfo object returns the filename of the image associated with that TabInfo. This filename source is relative to the Portal root directory and therefor simply needs to be prefaced with PortalSettings.HomeDirectory to get the image source relative to the site root.

<img src="<%=PortalSettings.HomeDirectory %><%#Eval("IconFileLarge") %>" 
width="124" height="88" alt="" />
Yobi21