Register   Login
     
  Categories  
  Archive  
  Authors  
19

So look at this post here, you can see there is some general confusion about the best place to put files and the best way to reference them (especially with friendly url's on!).

Instead of continually replying to them in forums, I will begin to point them at this article.

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\ ? 

You should generally put images and scripts with your module. Only place them in the portals\0\ directory if they are shared by a number of different modules.

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.

For an image, you can do something like:-

<img src='<%= Me.ResolveUrl("Images\blah.gif") %>'>

Remember, if its being databound, it's the # character:-

<img src='<%# Me.ResolveUrl("Images\blah.gif") %>'>

The ResolveUrl method on the user control will resolve from the current controls (your user control's) path. Page.ResolveUrl will resolve from the base of your application.

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?

See Above.

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?

Use, <%= Me.ResolveUrl("Includes\Item.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, ...)?

Best method is to use the Resources.zip method. Basically you zip up all your resources, images, js, etc (maintaining the folder structure).

In your .dnn file, add the following:-

<resourcefile>Resources.zip</resourcefile>

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>?

See above, resources.zip is your friend :)

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)?

Just include it, .dll's will automatically be moved to the bin directory. There may however be problems with other modules using a different version of the assembly as it may be replaced.

Hope this helps, post any other questions in comments, or the forums on this site.

Posted in: DotNetNuke

Post Rating

Comments

Anonymous User
# Anonymous User
Tuesday, May 10, 2005 2:20 PM
One of my modules uses a CSS stylesheet and I don't know how to use a background-image: url(...) properly without the full path and I can't use ResolveUrl... what can I do???
Scott McCulloch
# Scott McCulloch
Thursday, May 12, 2005 3:00 AM
It should adjust it when uploading the skin
Laverne Douglas
# Laverne Douglas
Friday, July 01, 2005 8:45 AM
Scott:
If I need to skin a module, like NewsArticles, would I not put resources in the Portal\# for each portal, since they will all need to have the module tweeked for themselves. This is assuming there are other items besides the css for skinning. Or are you refering to items like icons with transparent backgounds that would be the same no matter how you skin the module.
Anonymous User
# Anonymous User
Monday, November 07, 2005 12:24 AM




CompanyName - Survey
Survey allows you to create custom surveys
to obtain public feedback

01.00.00
SurveyResources.zip
CompanyName.Survey.SurveyController, CompanyName.Survey


CompanyName - Survey


Survey.ascx
View
http://www.dotnetnuke.com


Edit
Create Survey
EditSurvey.ascx
icon_survey_32px.gif
Edit

::



Anonymous User
# Anonymous User
Monday, November 07, 2005 10:17 PM
Scott: How do I dynamically set the title for a Module? For example: We have a single module control which allows us to Add/Edit new records. When we are adding a new record we would like the module title to be 'Add New Record' and when Editing an existing record we want it to read 'Edit New Record'. I've tried all the obvious things but it doesn't seem to be working :(
Scott McCulloch
# Scott McCulloch
Tuesday, November 08, 2005 3:01 AM
Anon User, try this post:-

http://www.smcculloch.net/Resources/Articles/tabid/213/articleType/ArticleView/articleId/152/LocalizingtheControlTitle.aspx

It shows how to localize, but the same concept aplies..
#
Thursday, June 07, 2007 1:33 AM
Expert Articles and Tutorials

Post Comment

Name (required)

Email (required)

Website

Enter the code shown above: