Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Alec Colebrook-Clark 134 posts 258 karma points
    Sep 09, 2009 @ 15:53
    Alec Colebrook-Clark
    0

    Javascript

    This is an extension of my last thread.

    Is it possible to call xsl macros while using javascript?

    If not what can i use instead to create a collection of states on one page showing different nodes?

    Cheers

    Alec

  • Petr Snobelt 923 posts 1534 karma points
    Sep 09, 2009 @ 16:33
    Petr Snobelt
    0

    * xslt macros works on server, javascript on client.

    * macros can create javascript, or hidden fields which can be used by js

  • Len Dierickx 150 posts 92 karma points
    Sep 09, 2009 @ 16:48
    Len Dierickx
    2

    I read your previous post, and I think what you need is a combination of an ASP.net library, base, and ajax calls.

    Base allows you to call methods from a DLL, where the path of the URL is converted to variables, like this:

    http://www.yourdomain.com/base/namespace/methodname/variable1/variable2.aspx

    Here is an example from my project:

    http://www.mydomain.com/base/ws/deletenote/1015.aspx

    where ws is the namespace in the DLL, deletenote a method that takes 1 argument: the ID of the database row or the note ID which is 1015 in this case.

     

    Here is more information on base: http://umbraco.org/documentation/books/introduction-to-base

    And my project which is relying on base: http://our.umbraco.org/projects/webstickies

     

  • Jesper Hauge 298 posts 486 karma points c-trib
    Sep 09, 2009 @ 21:56
    Jesper Hauge
    2

    I second Lens suggestion about using a combination of a .NET library (a dll-file), base and ajax. There's a more expanded explanation on umbraco /base in the wiki here:

    http://our.umbraco.org/wiki/reference/umbraco-base

    Regards
    Jesper Hauge

  • Alec Colebrook-Clark 134 posts 258 karma points
    Sep 10, 2009 @ 09:29
    Alec Colebrook-Clark
    0

    Thanks for the replies!

    At the moment in time i think i may have solved the issue using user-controls. Not a great way but i need to explore it a bit more. However thanks for the suggestions and the reference, I will know by the end of the day if i can achieve it my way or not so fingers crossed i guess!

    +1 for both, useful references ftw!

    Alec

  • Alec Colebrook-Clark 134 posts 258 karma points
    Sep 10, 2009 @ 16:07
    Alec Colebrook-Clark
    0

    Ok, my method is terrible, i get so got so far and suddenly realised "how am i going to load the nodes"

    I hate to keep asking for help as i dont want to annoy but if someone could point me in the direction of what i should be coding it will be much appreiciated!

    I have done the introduction and created the hello world but i dont see how this could solve my problem. Apologies for my naievity.

    Alec

  • Len Dierickx 150 posts 92 karma points
    Sep 11, 2009 @ 11:42
    Len Dierickx
    2

    Hi,

    A combination of jquery and a .net library would work well to load nodes, you could even get this with XSLT.

    * Create your library of methods you plan to call (getAllNotes for example?), example library for base can be found here: http://webstickies.svn.beanstalkapp.com/webstickies/trunk/WebStickies/webstickies/baseLibrary.cs

    * Enable base: http://umbraco.org/documentation/books/introduction-to-base/simple-base-samples

    <ext assembly="/bin/clark" type="kent.clark" alias="superman">
        <permission method="getAllNotes" allowAll="true" />
      </ext>

    * Load jQuery in your pages and start building and calling the URLs with Ajax calls:

    /* Example from my app

    * get the all notes for this page, with ID 200 

    *

    * /getNotes/pageID.aspx

    */

    jQ.get("/base/ws/getnotes/"+jQ.fn.websticky.pageID()+".aspx?date="+new Date().getTime(),function(xml){

      jQ("ws-notes ws-note",xml).each(function(){

        jQ("body").websticky({id:jQ(this).attr('id'),xPosition:jQ(this).attr('xPosition'),yPosition:jQ(this).attr('yPosition'),text:jQ(this).text()});

      });

    });


    The resulting XMl, or text can be parsed with jQuery, or you can write your own javascript functions.

    * You can test base by loading the URL in a browser: http://mydomain.com/base/superman/getAllNodes/startnodes/uptolevel/documenttypealias.aspx

    the method would accept the following arguments: 

     

     public static XPathNodeIterator getAllNodes(int startnode, int uptolevel, string documenttypealias){ code goes here ...}

     

    The method above should return a list of all nodes starting from a certain node, down to a certain level and show only those nodes with a specific documenttype.

     

    Hope this clearer,

    Len. 

  • Alec Colebrook-Clark 134 posts 258 karma points
    Sep 11, 2009 @ 11:53
    Alec Colebrook-Clark
    0

    Hi,

    Thank you very much Len. I'm sorry you had to go out of your way to help a newbie but it really is appreicated! I shall let you know how it goes!

    Many thanks,

    Alec

     

    +1 for awesome help!

  • Thomas Kahn 602 posts 506 karma points
    Oct 02, 2009 @ 09:34
    Thomas Kahn
    0

    I've used jQuery/AJAX to make calls to pages in Umbraco that load HTML-content snippets and inserts them into the current page without reloading the page. Take a look at:

    http://www.arosarkitekter.se/sv/arkitektur

    If you click on any of the headlines with the orange icons, the content that is "dropped down" is loaded from Umbraco using jQuery/AJAX. In Umbraco I use an XSLT- script to generate the HTML-code that is served. An example of a page that serves a particular snippet of code is found here:

    http://www.arosarkitekter.se/sv/arkitektur/bad-och-idrott

    These HTML-snippet serving pages don't take any arguments, but you could easily pass parameters via jQuery/AJAX:

    $("#myElement").load( "/contentServingPage/myPage.aspx", {name:"John",id:"100"}).

    Parameters are passed as name/value pairs (name and id with the values "John" and "100").

    Please ignore this if I my answer is totally out of context - I haven't followed the discussion in the previous thread you mention.

    /Thomas Kahn

  • Douglas 10 posts 30 karma points
    Jul 14, 2010 @ 18:55
    Douglas
    0

    New to Umbraco, hopefully I'm just missing something, and someone can help me out.

    Using the admin backend, I get javascript errors on every CWS stylesheet opened up.  Error is "sys is undefined".  When I edit stylesheets, I get the following error upon saving:  'Umbraco is undefined".  I can, however, make changes through FTP.

    I'm using IE8, Vista, Umbraco 4.0.4.2, runway was installed before adding CWS.

    Thanks, Douglas

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies