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

HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsClientAPIClientAPIPrototype or Mootools with DNN ClientAPI?Prototype or Mootools with DNN ClientAPI?
Previous
 
Next
New Post
2/16/2007 5:36 PM
 
I'm trying to use the mootools javascript framework (whose "$()" notation is based on the prototype js framework) in my module, but having some weird issues that I believe are caused by the following code in the DNN ClientAPI javascript (dnn.js, line 895, DNN v4.3.7):

//-- prototype/atlas shorthand functions
function $()
{
  var ary = new Array();
  for (var i=0; i<arguments.length; i++)
  {
    var arg = arguments[i];
    var ctl;
    if (typeof arg == 'string')
      ctl = dnn.dom.getById(arg);
    else
      ctl = arg;

    if (ctl != null && typeof(Element) != 'undefined' && typeof(Element.extend) != 'undefined')   //if prototype loaded, we must extend the object
        Element.extend(ctl);
       
    if (arguments.length == 1)
      return ctl;

    ary[ary.length] = ctl;
  }
  return ary;
}


I am using the $('mydiv') notation to access an element on the page and change its innerHTML property.  But when I do, another div element's contents are modified (cleared).  The 2 div's have unique id's.  My reason for suspecting this function is that I can successfully do the task if I use dnn.dom.getById(arg) directly... but then I don't have access to the mootools extension methods.

Any ideas?


Charlie Solomon
Beldin Technologies
Custom Software Solutions, DotNetNuke Modules
www.beldintechnologies.com
 
New Post
2/16/2007 5:59 PM
 
Update:

I implied that the function listed above is causing my problem... I didn't mean to.  I can make my code work if I use dnn.com.getById directly, and don't use mootools/prototype notation.

So I guess my real question here is has anyone been successful using mootools or prototype in the context of a DNN installation?  I'd really like to access some of the features of the mootools framework.

Thanks.


Charlie Solomon
Beldin Technologies
Custom Software Solutions, DotNetNuke Modules
www.beldintechnologies.com
 
New Post
2/19/2007 9:06 AM
 

The whole idea of the $ function and who "owns" that "namespace" has become quite muddy.  When I first learned of the use of $ and found that MS was adopting the same notation, I decided to do it as well.  For at the time, I felt that all frameworks simply used it as a quick way to get the reference to a DOM element.  Soon afterwards I learned that frameworks like prototyle use it for much more.  Apparently, MS learned this as well, and decided to switch to $get.  What I never understood is why they went through all the trouble of creating a nice namespace hierarchy, minimizing chances to have conflicting functions, then decided to scrap the whole idea and make shortened alias' with the $.  In essence, they are saying they "own" the $ namespace.  I have commented back and forth on this issue here.

Unfortunatly, I cannot just yank my $() function since I have to worry about backwards compatibility (at the time MS did it they were in beta so they could).  My $ function should be functioning with prototype last time I checked.

Hope this gives you a little more insight.


 
New Post
7/18/2007 12:21 PM
 

I'm up against the same problem, has anyone found a fix?

 
New Post
7/18/2007 12:32 PM
 

I dropped MooTools in my module development shortly after this post because I couldn't get all the functionality to work... Jon's function above uses the Prototype ".Extend" method to access that framework's functionality if it is loaded, so like he said above, Prototype should work.



Charlie Solomon
Beldin Technologies
Custom Software Solutions, DotNetNuke Modules
www.beldintechnologies.com
 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsClientAPIClientAPIPrototype or Mootools with DNN ClientAPI?Prototype or Mootools with DNN ClientAPI?


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