Last post Apr 20, 2005 01:57 AM by smcculloch
Apr 19, 2005 11:54 AM|leep2|LINK
I'm just learning how to create custom modules for DNN 3.0.13 and am confused about how to access resources my module may need (such as scripts (.js), images, etc).
1) Where should images and scripts be located? In a folder off of DesktopModules\MyCompany.MyModule\ ? Or would they be in a folder off of Portals\0\ ?
2) In the .ascx how do I form URLs to refer to the files? I've tried Images\blah.gif, DesktopModules\MyCompany.MyModule\Images.blah.gif, I've tried using ~ and not using ~, prefixing the url with \ and not prefixing it with \... nothing seems to work.
BTW, I have friendly urls turned on.
3) I've tried doing <img src='<%= GetImageUrl(...) %>' ... >, but the "<%= ... %>" goes through to the client without being pre-processed by ASP.NET. Is this normal, or is something not working properly?
4) How do I include .js scripts in my module? Can I just put a <link src="..." ...> at the top of the .ascx? How do I form the url so it finds the .js?
5) In the .dnn file, if I specify <file><path>Some/Path/That/I/Need</path><name>blah.gif</name></file> will that full path be created properly if it doesn't exist? Or do I need to specify one folder at a time somhow (like Some, then Some/Path, then Some/Path/That,
6) If I need several files with the same name but different paths (such as Blue\Line.gif, Red\Line.gif, Green\Line.gif), how do I put them in the PA zip? Can I have paths in the zip? I've always put all the files in the PA zip without paths. How would I list
them in the .dnn file so it knows which line.gif from the zip file goes with which <path>...</path><name>line.gif</name>?
7) If my module needs a third-party dll for a control it uses, do I just include it in the PA zip file and in the .dnn (<file><name>ThirdParty.dll</name></file> with no <path>)? Will this cause any conflicts if some other module also includes that dll (maybe
even a different version)?
Thanks in advance for any light you can shed on these issues for me. [:)]
Apr 19, 2005 11:25 PM|kpetro|LINK
I will try to answer to the best of my knowledge:
1, 2, 3) You should have you images (or any resource) in the DesktopModules\MyCompany.MyModule\ directory. The path should be set up using the TemplateSourceDirectory property on the Control. (<IMG SRC=""" & Me.TemplateSourceDirectory & "/abc.gif"" WIDTH="15"
4) I have never tried anything such as this in a Module, but I assume you can reference the JS file the same way you refereance an image.
5) Yes you can specify a path in the dnn config file and when you upload your module the directory will be created.
6) I assume you will then need to combine the answer from 1,2,3 with the directory you are going to create in 5 to accomplish what you want.
<IMG SRC=""" & Me.TemplateSourceDirectory & "Blue\Line.gif"" WIDTH="15" BORDER=""0"" HEIGHT=""15"">
7) You can specify any DLL files in the dnn config file and they will get uploaded. I believe ensuring there are no conflicts will be a manual process.
Apr 19, 2005 11:46 PM|SchelianHP|LINK
that are a lot of different questions.
Have a look at the folder documentation\public under the root folder of your dnn directory, there are a lot of documentation which will give you many answers to your questions.
The most important document is the DotNetNuke Module Developers Guide.
If you have a specific problem after reading the documents, post the more detailed problem.
Apr 20, 2005 12:13 AM|smcculloch|LINK
Apr 20, 2005 12:28 AM|leep2|LINK
Thank you! That cleared up a lot of my confusion. Especially the Resources.zip. That will be a LIFE saver. I assume the paths in the Resources.zip will be duplicated in the DesktopModules/MyCompany.MyModule/ folder, correct?
BTW, it's kind of a kewl feeling to have my original posting immortalized on your site. [:D]
Apr 20, 2005 01:57 AM|smcculloch|LINK
Yep, the folders in the resources.zip will be reflected in your modules directory.