Accessing resources from custom module

Rate It (1)

Last post 04-20-2005 1:57 AM by smcculloch. 5 replies.

Sort Posts:

  • Hmm [^o)] Accessing resources from custom module

    04-19-2005, 11:54 AM
    • Member
      130 point Member
    • leep2
    • Member since 04-21-2004, 11:06 AM
    • Posts 26

    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. Smile [:)]
    -----
    Lee

  • Re: Accessing resources from custom module

    04-19-2005, 11:25 PM
    • Member
      25 point Member
    • kpetro
    • Member since 04-19-2005, 3:41 PM
    • Posts 5

    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" BORDER=""0"" HEIGHT=""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.

  • Re: Accessing resources from custom module

    04-19-2005, 11:46 PM
    • Contributor
      2,800 point Contributor
    • SchelianHP
    • Member since 02-27-2003, 1:59 AM
    • Germany
    • Posts 560

    Lee,

    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.

     

  • Re: Accessing resources from custom module

    04-20-2005, 12:13 AM
    • Contributor
      6,930 point Contributor
    • smcculloch
    • Member since 06-17-2002, 4:48 PM
    • Sydney, Australia
    • Posts 1,386
    I have tried to answer the above questions here.
    Modules, Skins & Skin Objects @ www.smcculloch.net
  • Yes [Yes] Re: Accessing resources from custom module

    04-20-2005, 12:28 AM
    • Member
      130 point Member
    • leep2
    • Member since 04-21-2004, 11:06 AM
    • Posts 26

    smcculloch,
    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. Big Smile [:D]

    -----
    Lee

  • Re: Accessing resources from custom module

    04-20-2005, 1:57 AM
    • Contributor
      6,930 point Contributor
    • smcculloch
    • Member since 06-17-2002, 4:48 PM
    • Sydney, Australia
    • Posts 1,386

    Yep, the folders in the resources.zip will be reflected in your modules directory.

    Modules, Skins & Skin Objects @ www.smcculloch.net
Page 1 of 1 (6 items)