Copied to clipboard

Flag this post as spam?

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


  • hickoryFornander 32 posts 52 karma points
    Dec 21, 2009 @ 03:40
    hickoryFornander
    0

    Inheritance problems

    I have a problem when it comes to inherit css and javascript to nodes lower than the second level.

    To make the interface easy for the end user, I have put all nodes (that the user can access from the menu), in files under the home page. For every node that have more children, these are then place under its parent node. In this way I will get a nice hierarchal folder system. The doctypes are as the content, placed in the hierarchal structure.

    All templates are placed directly under a master template which they inherit from.  The master template imports all the css and javascripts files. The problem is when the content pages are located more than one level under the homepage, the javascript and the css stops working, even though their templates are locater irectly under the master template.  It works fine for the nodes directly under the home page. How can I make the inheritance work through the whole hierarchal structure?

     

    The second problem I have is related to this problem. I have imported the jCarousel packet and it works fine, when the node keeping the carousel is placed directly under the Content folder. I would like to take the javascript out from the xslt and put it in the javascrit file, so I have everything in one place. But the script tag includes some xslt, and I do not know how to seperate them.

    <script type="text/javascript">
    $(document).ready(function() {
       $('#s3slider').s3Slider({
          timeOut: <xsl:value-of select="$currentPage/data[@alias='speed']"/>
       });
    });
    </script>

     

    Does anyone know how to do this?

    Thankful for all help I can get!

     

     

     

  • jonok 297 posts 658 karma points
    Dec 21, 2009 @ 04:38
    jonok
    1

    I could be misunderstanding your first problem here, but if you put a leading '/' character in front of your javascript and css file paths then they should always load correctly.

  • hickoryFornander 32 posts 52 karma points
    Dec 21, 2009 @ 09:18
    hickoryFornander
    0

    Thank you Jonok, that solved my first problem! =)

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Dec 21, 2009 @ 09:20
    Dirk De Grave
    0

    Yes, as jonok suggests, check whether you're referencing your js correctly, most probably you're not having a leading slash.

    Don't think there's a way to separate js from the xslt, but you don't need to include it in your xslt. you can include the js in your template and use <%=umbraco.presentation.nodeFactory.Node.GetCurrent().getProperty("alias") instead of the <xsl:value-of> from your xslt.

     

    Hope this helps.

    Regards,

    /Dirk

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Dec 21, 2009 @ 09:56
    Sebastiaan Janssen
    0

    I don't really see how you could solve the second problem, if you really (really!?) need the slider speed to be configurable from Umbraco, then you'd need something like you already have there..

  • hickoryFornander 32 posts 52 karma points
    Dec 21, 2009 @ 10:23
    hickoryFornander
    0

    Ok, thanks a lot for all your replies. I will keep the javascript in the xslt then.=)

     

     

Please Sign in or register to post replies

Write your reply to:

Draft