Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...How to reference jQuery-Migrate in an ASCX file?How to reference jQuery-Migrate in an ASCX file?
Previous
 
Next
New Post
5/2/2014 8:47 PM
 

Hi.  I have a DNN 7.2.1 site that's using a customized skin that is still using SolPartMenu.  I updated it to use the DDRMenu equivalent like so:

From:  <%@ Register TagPrefix="dnn" TagName="MENU" Src="~/Admin/Skins/SolPartMenu.ascx" %>

To: <%@ Register TagPrefix="dnn" TagName="MENU" Src="~/DesktopModules/DDRMenu/SolPartMenu.ascx" %>

 

The only problem is that the DDRMenu replacement uses the following js file which depends on some deprecated jQuery functions that are no longer included with jQuery as of 1.9.0:

 /DesktopModules/DDRMenu/SolPart/SolPartMenu.min.js

 

The solution is to load the jquery-migrate-1.2.1.js Javascript library that's already included within DNN as it would provide access to those functions that are no longer available.  Unfortunately, the jQuery-Migrate library doesn't load by default with this skin.  I've verified this by monitoring via Fiddler2.  Yes, the jQuery and jQueryUI libraries are loading fine.

 

What entry do I put in the skin's ASCX file to force the jQuery-Migrate library to load?

Or is there a better solution?  And no, upgrading the skin is not an option right now for reasons that would take too long to explain here, although it will probably happen down the road.

Thanks and See Ya!
Van


See Ya! Van
 
New Post
5/5/2014 12:32 PM
Accepted Answer 

you could simply add a copy of jquery-migrate to your skin folder and reference that explicitly via a script src tag, but it's better to use the API's. In this case I would suggest adding this to the skin code behind i.e. the .ascx.cs  (alternatively you can use inline script tags (see http://weblogs.asp.net/ahmedmoosa/arc... for various examples)

JavaScript.RequestRegistration(CommonJs.jQueryMigrate);


Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
5/6/2014 12:17 PM
 

Cathal, thanks for the reply!

I was going to add the library reference to the code behind file.  This lead me down another rabbit hole because the code behind file for the skin, ~/admin/Skins/skin.vb, didn't actually exist.  Hmmm... That's interesting.  I had seen the skin.vb file referenced in plenty of skins over the years, but I never thought to look at it before.

Well, after some googling a bit, I didn't find a definitive answer as to where the skin.vb file is located.  It must be some sort of virtual file.  However, I found a couple of posts that suggested that it was very rare for a DNN skin to have a physical code behind file.  The popular opinion seems to be to use inline script tags, if necessary.

 

OK, so here's my current solution in case anyone else is experiencing a similar issue when using DDRMenu as a SolPartMenu replacement.  I added the following lines near the top of the skin.ascx file:
     <%@ Register TagPrefix="dnn" TagName="jQuery" src="~/Admin/Skins/jQuery.ascx" %>
     <dnn:jQuery runat="server" jQueryUI="true" DnnjQueryPlugins="true" jQueryHoverIntent="true"></dnn:jQuery>
     <script type="text/javascript" src="/Resources/Libraries/jQuery-Migrate/1.2.1/jquery-migrate.js"></script>

 The jQuery, jQueryUI, and other DNN jQuery-related files are loaded using the DNN API to prevent conflicts in cases where they might be loaded more than once.  I didn't find any documentation about using the DNN API to load the jQuery Migrate library, so it is loaded using the old fashioned method which might be subject to load conflicts.  Hopefully it will be a rare module that tries to load jQuery Migrate library manually, though.

By the way, there's a great post by Jonathan Sheely that talks about properly loading jQuery in your skin:
     http://inspectorit.com/cms/dotnetnuke...

 

Now the SolPartMenu template for the DDRMenu is happy and works in Chrome, IE, and Firefox without any issues:
     <%@ Register TagPrefix="dnn" TagName="MENU" Src="~/DesktopModules/DDRMenu/SolPartMenu.ascx" %>

See Ya!
Van


See Ya! Van
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...How to reference jQuery-Migrate in an ASCX file?How to reference jQuery-Migrate in an ASCX file?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, 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 DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out