Copied to clipboard

Flag this post as spam?

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


  • Dwayne A 97 posts 117 karma points
    May 18, 2011 @ 11:00
    Dwayne A
    0

    List pages by category

    Hi,

    I'm creating a site with various navigation categories, and I've hit a wall. Any help is appreciated.

    I need to list pages as niceURLs according to the category they belong. The user must have the abilty to create a page by category. I thought of passing parameters from a macro, but perhaps it's simpler and cleaner to create a dummy page for each category and nest subpages under each to be iterated in four menus?

    Category One
      - Page one
      - Page two

    Category Two
      - Page one
      - Page two

    ... and so on.

    Then address each category and iterate the subpages ONLY, hiding the category page.

    Any ideas on how to do this in one or several xslt files.

  • Rich Green 2246 posts 4008 karma points
    May 18, 2011 @ 11:06
    Rich Green
    0

    Hey,

    I'm not 100% sure what you're asking but my gut feeling is that your revised structure is correct.

    On the Category One template page you can add a macro so that if a user lands on it they get redirected to the first page (Page One)

    Make sense?

    Rich

  • Dwayne A 97 posts 117 karma points
    May 18, 2011 @ 11:17
    Dwayne A
    0

    Hi Rich,

    When I say "user", I'm referring to content editors. They need to create a page according to a category. This is to assure the page is displayed under the proper menu. I've also created a Data Type to insure they can choose a categoy and the proper style (backgrounds, color) is applied to the page upon browser rendering.

    I need to figure out a way they can create a page and insure the URL is written to one of four menus.

  • Rich Green 2246 posts 4008 karma points
    May 18, 2011 @ 11:22
    Rich Green
    0

    Hey Dwayne,

    I understand.

    The content editors will be creating page(s) under a category, therefore you know that those pages belong to that category.

    What you're looking to achieve is straight forward, so I don't think you need to over complicate it.

    If you create the following structure:

    Category 1

    - Content page 1

    - Content page 2

    Category 2

    - Content Page A

    - Content Page B

    Then create a new xslt file and choose the 'Site Map' template, you will have most of what you need already. The urls will already be correct and the site map xlst will give you a great start in rendering the menu.

    Rich 

  • Dwayne A 97 posts 117 karma points
    May 18, 2011 @ 11:26
    Dwayne A
    0

    We seem to be on the same page. I suppose I should be more explicit and ask, how?

    I'm relatively green at xslt, and although I have scripts for simple topNode menus, level menus and such, I do not know how to differentiat by nodeID, nodeName or the like. I need  some help getting started with the xslt ;-)

  • Rich Green 2246 posts 4008 karma points
    May 18, 2011 @ 11:33
    Rich Green
    0

    Did you try the site map xslt template?

    Rich

  • Dwayne A 97 posts 117 karma points
    May 18, 2011 @ 11:37
    Dwayne A
    0

    Never tried it. Will that get me started or solve the issue?

  • Rich Green 2246 posts 4008 karma points
    May 18, 2011 @ 11:38
    Rich Green
    0

    It's certainly a good start.

    Rich

  • Dwayne A 97 posts 117 karma points
    May 18, 2011 @ 11:41
    Dwayne A
    0

    No idea where to begin. Thanks anyway.

  • Rich Green 2246 posts 4008 karma points
    May 18, 2011 @ 11:50
    Rich Green
    0

    Hey,

    Did you read this:

    "If you create the following structure:

    Category 1

    - Content page 1

    - Content page 2

    Category 2

    - Content Page A

    - Content Page B

    Then create a new xslt file and choose the 'Site Map' template, you will have most of what you need already. The urls will already be correct and the site map xlst will give you a great start in rendering the menu."

    Do you mean you don't know how to do the above, do you have a problem inserting a macro?

    Rich

  • Dwayne A 97 posts 117 karma points
    May 18, 2011 @ 11:58
    Dwayne A
    0

    Creating the xslt file and macro are not a problem. I am simply not certain how to address the various categories once I have the file xslt created. I am assuming I need to call on the category on list ONLY those subpages in a particular menu. I have never created a site map xslt, but I assume it will need some tweaking, and that's weher I am stumped. What to address once I have the site map in place: nodeID, pageID, parent level?

    Does that make sense?

  • Rich Green 2246 posts 4008 karma points
    May 18, 2011 @ 12:01
    Rich Green
    0

    Hey Dwayne,

    It would be helpful if you created the site map as described and then post the output here, or post an image of your content structure.

    I'm doing my best to help you!

    Rich

  • Dwayne A 97 posts 117 karma points
    May 18, 2011 @ 12:10
    Dwayne A
    0

    I understand, and appreciate it. I was just thinking I could get some feedback on a general level. I'll get something put together, post it, and we can take it from there.

  • Dwayne A 97 posts 117 karma points
    May 18, 2011 @ 15:32
    Dwayne A
    0

    Hi again

    I've created a rough site structure with at least one page under each of the 4 categories. There is a file outside these categories, as some of the pages will be created manually in a fifth menu. I've also created a sitemap XSLT. I have no idea where to begin now, so any help is GREATLY appreciated. The grey area in the photo is the site in question. This is a multisite installation, so the other nodes above are containers for the other sites.

     

    Here's the sitemap XSLT

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <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" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:uTube.XSLT="urn:uTube.XSLT"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets uTube.XSLT ">
    <xsl:template match="/">
    <div id="sitemap">
    <xsl:call-template name="drawNodes">  
    <xsl:with-param name="parent" select="$currentPage/ancestor-or-self::* [@isDoc and @level=1]"/>  
    </xsl:call-template>
    </div>
    </xsl:template>

    <xsl:template name="drawNodes">
    <xsl:param name="parent"/>
    <xsl:if test="umbraco.library:IsProtected($parent/@id, $parent/@path) = 0 or (umbraco.library:IsProtected($parent/@id, $parent/@path) = 1 and umbraco.library:IsLoggedOn() = 1)">
    <ul><xsl:for-each select="$parent/* [@isDoc and string(umbracoNaviHide) != '1' and @level &lt;= $maxLevelForSitemap]">
    <li>  
    <a href="{umbraco.library:NiceUrl(@id)}">
    <xsl:value-of select="@nodeName"/></a>  
    <xsl:if test="count(./* [@isDoc and string(umbracoNaviHide) != '1' and @level &lt;= $maxLevelForSitemap]) &gt; 0">   
    <xsl:call-template name="drawNodes">    
    <xsl:with-param name="parent" select="."/>    
    </xsl:call-template>  
    </xsl:if>
    </li>
    </xsl:for-each>
    </ul>
    </xsl:if>
    </xsl:template>
    </xsl:stylesheet>
Please Sign in or register to post replies

Write your reply to:

Draft