Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

AppTheory specializes in solutions based on the DotNetNuke platform and has 2 employees on the DotNetNuke Core Team.
  Need Help?  
Professional technical support for DotNetNuke is available from DotNetNuke Corporation.
 


  Ads  
Iron Speed Designer is a software development tool for building database, reporting, and forms applications for .NET without hand-coding.
 


  Sponsors  

Meet Our Sponsors

OnyakTech
The best choice for your web site host, email hosting, and domain registration.
CrystalTech Web Hosting™
Webhost4life, specialists in DNN hosting
Mad Development is a full service interactive agency focusing on the merge of design, technology, e-commerce, and affiliate marketing by providing total website solutions.
AspDotNetStoreFront - E-Commerce by Design - The Leading ASP.NET shopping cart platform for developers!
 


DotNetNuke Forums
 
  Forum  DotNetNuke® Pro...  ClientAPI Compo...  dnn.dom.loadScript and PerformSubstitution
Previous Previous
 
Next Next
New Post 3/30/2008 8:28 PM
User is offline Fausto Manzoni
33 posts
10th Ranked


dnn.dom.loadScript and PerformSubstitution 

Hi Jon,

To dinamically load scripts on demand in my applications, I now use the dnn.dom.loadScript method  from dnn.js.
To make life more convenient I found this technique, which allows to load scripts, directly from embedded resources.

Here's one example of how this technique can be applied:
File:  dnn.js , line 1022

dnn.dom.loadScript(dnn.dom.getScriptPath() + 'dnn.scripts.js', null, oRef(aSrc, aText, callBack));

can be changed in:

dnn.dom.loadScript('<%=WebResource("dnn.scripts.js")%>', null, oRef(aSrc, aText, callBack));

Now,  to allow the url substitution, we need to set the required attribute for the dnn.js:

<Assembly: System.Web.UI.WebResource("dnn.js", "text/javascript", PerformSubstitution:=True)> 

Finally, we have to embed the dnn.scripts.js

<Assembly: System.Web.UI.WebResource("dnn.scripts.js", "text/javascript")> 

I hope this helps.

Regards 
Manzoni Fausto

 
New Post 3/31/2008 5:59 PM
User is offline Jon Henning
1605 posts
www.codeendeavors.com
5th Ranked










Re: dnn.dom.loadScript and PerformSubstitution 

Interesting post, however, the substutition will not work for the dnn.js file as it is not interpreted by asp.net.  However, if we wanted to we could send the value down via the ClientAPI's setVar.  

The best and most performant mode of adding script references is to have an external file reference as this puts no load on the server (ASP.NET process).  This is the default mode that DNN will ship in and will be the recommended way. 

Embedded scripts are nice in that they allow a developer to simply add a reference to a dll to integrate with their project and not need to worry about copying one or more scripts as well.  With dnn, we have the luxury of being able to include the externals without any additional overhead (you already need a lot of files to get dnn to run, whats a few more...)

 


 
New Post 4/1/2008 12:14 AM
User is offline Fausto Manzoni
33 posts
10th Ranked


Re: dnn.dom.loadScript and PerformSubstitution 
Modified By Fausto Manzoni  on 4/2/2008 10:23:07 AM)

What you say is correct, although I do not know exactly the impact that the use of embedded scripts can have in terms of performance,(there are a number of applications that utilize embedded scripts).

However, there is another performance issue that you might consider, that is the number of HTTPRequest required to render the page, as documented here.
In DNN each module can have its own CSS and more than one javascript file,(especially an ajax module).
At the end a page can require a lot of external files to be rendered.
Adding script references through the Script Manager, gives the possibility to combine all script references,(present in Its collection) in a single compressed file, using an HttpHandler.

An example of this technique, the ToolkitScriptManager, can be found in the AjaxControlToolKit.
I use a similar technique for css added through CSS placeholder.
I know that this may not be suitable for all possible scenarios but, in my case, the performance is significantly improved.

"the substutition will not work for the dnn.js file as it is not interpreted by asp.net."
In the ClientApi beta it work.

 
New Post 4/3/2008 5:28 AM
User is offline Jon Henning
1605 posts
www.codeendeavors.com
5th Ranked










Re: dnn.dom.loadScript and PerformSubstitution 

Yes, I have considered the idea of combining the scripts before.  See this blog from last June.

http://www.dotnetnuke.com/Community/Blogs/tabid/825/EntryID/1469/Default.aspx


 
Previous Previous
 
Next Next
  Forum  DotNetNuke® Pro...  ClientAPI Compo...  dnn.dom.loadScript and PerformSubstitution
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, please observe the following posting guidelines:

1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


Web Development and Strategy Firm
The Risdall Interactive Agency s websites, strategies, branding, & promotion in digital space.
www.Risdall.net/
Windsor Management Group
Fund Accounting Software for K12 Education.
Infinitevisions.com
Convert Visitors to Customers
In order to bring value to your users, we must first understand them. VIVIDSITES will help you build a custom web application and interactive marketing tools that your users will thank you for. We marry high-end creative with head banging technology to entertain and convert visitors into paying customers. Call 314.514.0505 or visit us at http://www.vividsites.com to find out how.
- V I V I D S I T E S -

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP