|
|
 Rank: Enthusiast
Joined: 8/21/2008 Posts: 28 Location: Kolkata, India
|
I have a javascript menu. I want this menu to be done in XSLT. I am very new in Umbraco. Can anybody tell me the way ?
|
|
 Rank: Addict
Joined: 9/27/2007 Posts: 977 Location: Belgium
|
Hi satamita, First: Welcome to umbraco. As to answer your question, could you detail your request a bit. I guess you want the menu to pull info from nodes in the content section, right? Get us some info about how you've structured the content tree, and what you'd like to see in the navigation (multiple levels?, hide certain nodes?, and more...). Greetz, /Dirk
level 1 certified - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
|
|
 Rank: Enthusiast
Joined: 8/21/2008 Posts: 28 Location: Kolkata, India
|
Hi Dirk,
Thanks for replying soon. I have started using Umbraco from today. I have an old website and I am remodeling it with Umbraco. In the old website I have an existing JavaScript menu. JavaScript functions are written in a an external .js file and I am building the menu by calling JavaScript functions from HTML page. This is a multi level menu.
Now I want this menu to be done in XSLT. I am at loss right now. I don’t know where to start. I have created the mainpage Template but unable to add navigation there. First of all I haven’t created the navigation tree yet. I don’t know where to create it. Please assist me. I am having hard times.
thanks, Satamita
|
|
 Rank: Addict
Joined: 9/27/2007 Posts: 977 Location: Belgium
|
Hi Satamita, If you're not really familiar with the concepts of content/doc types/templates/... , have a look here. tim has created a great list of useful resources. Also, give warren's 'Creative Website Wizard' package a try. It's a great sample to play with and might teach you a bit more about how to create a simple website quite easily. His package can be easily imported as a package. Here are the steps to import his package. Go to 'Developer' section Right-click 'Macro' and select 'Import Package' Click the link to go to the online package repository. Follow the links as from there and its package will get installed for you. Once you get to explore the various features, you'll find out how the site is built! I'd like to be of more help, but would like you to explore the things mentioned above. Pay good attention to the way doc types/templates/macro/xslt are created and how it all glues together. Don't hesitate to ask for more questions as you move on. Good luck! Regards, /Dirk
level 1 certified - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
|
|
 Rank: Enthusiast
Joined: 8/21/2008 Posts: 28 Location: Kolkata, India
|
Hi Dirk,
Thanks man. That’s a very useful link. I am going through it.
Thanks, Satamita
|
|
 Rank: Enthusiast
Joined: 8/21/2008 Posts: 28 Location: Kolkata, India
|
Hi Dirk,
I cant import this package. Its giving an error. I dont know why this is happening. Is there any other way to learn the macro/xslt/contentTree ? Please help me out.
Thanks, Satamita
|
|
 Rank: Addict
Joined: 9/27/2007 Posts: 977 Location: Belgium
|
Hi satamita, Just a quick question? Is it v3.x or v4 you're using right now? Don't think the Creative Website Wizard is currently optimised for v4. Problems at installing packages are probably due to security settings. As a quick test, make sure 'Everyone' has full access to the complete umbraco installation folder! As you're not really far in exploring umbraco, try reinstalling umbraco and importing the package again. Or, try importing the package twice. I've had situations where errors have occured but still the package got installed fine. I'm stressing this because the Creative Website Wizard is really the best way to start exploring the various features of umbraco. Regards, /Dirk
level 1 certified - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
|
|
 Rank: Enthusiast
Joined: 8/21/2008 Posts: 28 Location: Kolkata, India
|
Hi Dirk, You are right. This problem is related with security settings. After importing I have some sample XSLT files and macros. With this help I have created a XSLT file and a related macro. XSLT file code is : Code:<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE xsl:Stylesheet [ <!ENTITY nbsp " "> ]> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:umbraco.library="urn:umbraco.library" exclude-result-prefixes="msxml umbraco.library">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:template match="/">
<!-- start writing XSLT -->
<ul id="Navi"> <xsl:for-each select="$currentPage/ancestor::root/node [string(./data [@alias='umbracoNaviHide']) != '1']"> <li> <xsl:if test="$currentPage/@id=current()/@id"> <xsl:attribute name="class">Selected</xsl:attribute> </xsl:if> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:attribute name="title"><xsl:value-of select="@nodeName" /></xsl:attribute> <xsl:value-of select="@nodeName" /> </a> </li> </xsl:for-each>
<xsl:for-each select="$currentPage/ancestor-or-self::node [@level=1]/node [string(./data [@alias='umbracoNaviHide']) != '1']"> <li> <xsl:if test="$currentPage/ancestor-or-self::node/@id = current()/@id"> <xsl:attribute name="class">Selected</xsl:attribute> </xsl:if> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:attribute name="title"><xsl:value-of select="@nodeName" /></xsl:attribute> <xsl:value-of select="@nodeName" /> </a> </li> </xsl:for-each> </ul>
</xsl:template>
</xsl:stylesheet> and after this I have inserted that macro in the master template. But after that when I browse to see the menu on pages I cant see it. I dont know If I am missing something here. I am describing the steps I have followed: 1. create a XSLT file with code written above. 2. create a macro and attach this xslt with it. (I haven't added any parameter in the macro) 3. Insert the macro in master template. Result no Menu created. another thing this menu is like having main links on above and then sublinks on mouse over. Any idea about adding javascript in xslt file.
|
|
 Rank: Enthusiast
Joined: 8/21/2008 Posts: 28 Location: Kolkata, India
|
Thanks, Satamita
|
|
 Rank: Addict
Joined: 9/27/2007 Posts: 977 Location: Belgium
|
Ok, It seems you're on the right track :) Have you set a template for the page you're visiting? You've already added the macro to the master template, but have you set the master template for the template set for the document type. Pfhee, doesn't really read well huh? Let's rephrase: - Document type for the page you're visiting has a template set? - Master template for the template set above is correct? If it isn't, well, fix it! If it is, than there's something else wrong. Let's try to find out then! First, change the xslt to this: Code:<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE xsl:Stylesheet [ <!ENTITY nbsp " "> ]> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:umbraco.library="urn:umbraco.library" exclude-result-prefixes="msxml umbraco.library">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:template match="/">
<!-- start writing XSLT -->
<ul id="Navi">
<xsl:for-each select="$currentPage/ancestor::root/node [string(./data [@alias='umbracoNaviHide']) != '1']"> <li> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:attribute name="title"><xsl:value-of select="@nodeName" /></xsl:attribute> <xsl:value-of select="@nodeName" /> </a> </li> </xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet> and see if that works! It just list all nodes underneath the parent node! Let us know who it goes Regards, /Dirk
level 1 certified - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
|
|
 Rank: Enthusiast
Joined: 8/21/2008 Posts: 28 Location: Kolkata, India
|
Hi Dirk, I am happy that I am learning Umbraco. Thanks for your help. Now menu items are coming on the web page like
Frontpage [this is the main link 1] Industry Focus [this is the main link 2] General [this is the main link 3] AboutUs [this is the sublink1 of main link 1] Site Map [this is the sublink2 of main link 1] Newsletter [this is the sublink3 of main link 1] Professional Societies [this is the sublink4 of main link 1] Articles & Whitepapers [this is the sublink5 of main link 1] Contact Us [this is the sublink6 of main link 1] Calendar [this is the sublink7 of main link 1]
now if I select another main link its sub links are showing. So I think this menu is working. Now do you have any idea of making this menu horizontal like
Frontpage Industry Focus General
and sub menus will come on mouse over as it was happening with my existing JavaScript function.
|
|
 Rank: Addict
Joined: 9/27/2007 Posts: 977 Location: Belgium
|
Hi, I would go for a css solution then. Just create the necessary css classes/id's to make the menu behave like you want. Sadly enough, I don't have the knowledge to create such css stuff, I'm hoping someone else in the forum can help you out on this one. Or ultimately, google for some tips and trick! Greetz, /Dirk
level 1 certified - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
|
|
 Rank: Enthusiast
Joined: 8/21/2008 Posts: 28 Location: Kolkata, India
|
Dirk, Is this possible with JavaScript or I have to use CSS ?
Thanks, Satamita
|
|
|
Guest |