Copied to clipboard

Flag this post as spam?

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


  • Molly 94 posts 134 karma points
    Jul 01, 2013 @ 23:04
    Molly
    0

    List hidden sub pages from current page

    Hi 

    I'm sorry if this is very simple but i've spent longer than necessary trying to list the hidden pages of current page.

    They are news items that i have hidden from the main navigation but want to display as a sidebar on the news page where i have the news items paginated. 

    The List Sub Pages From Current Page works when not hidden and i thought by changing this line :

    <xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) != '1']">
    to 
    <xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) = '1']">
    But it doesn't work. 
    Thanks in advance
  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jul 02, 2013 @ 08:36
    Dennis Aaen
    1

    Hi Molly,

    I just tried this on one of my solutions, and when I use the following XSLT, it´s list the pages of current page which has the UmbracoNaviHide sets to true.

    <ul>
    <xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) = '1']">
        <li>
            <a href="{umbraco.library:NiceUrl(@id)}">
                <xsl:value-of select="@nodeName"/>
            </a>
        </li>
    </xsl:for-each>
    </ul>

    I hope this also will work for you.

    /Dennis

  • Molly 94 posts 134 karma points
    Jul 02, 2013 @ 10:24
    Molly
    0

    Thanks Dennis. 

    When i visualize the xslt it works fine but will not display on my frontend, no errors show. On the same page i have an xslt that displays the news items in full and have one per page. This works fine so i can't see why it would affect it.

     

    Thanks

    Molly 

  • Molly 94 posts 134 karma points
    Jul 02, 2013 @ 10:28
    Molly
    0

    I've just taken the other xslt off the page and it still isn't working so i guess i can rule that out. I don't know why it isn't working on the page when it visualizes fine. hmm 

     

  • Rich Green 2246 posts 4008 karma points
    Jul 02, 2013 @ 10:29
    Rich Green
    0

    Hey Molly,

    What happens if you try this?

    <ul>
    <xsl:for-eachselect="$currentPage/* [@isDoc]">
       
    <li>
    <xsl:value-ofselect="umbracoNaviHide"/>
       
    </li>
    </xsl:for-each>
    </ul>
  • Rich Green 2246 posts 4008 karma points
    Jul 02, 2013 @ 10:30
    Rich Green
    0

    Note, there should be spaces between the select (darn editor)

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jul 02, 2013 @ 10:40
    Dennis Aaen
    0

    Okay sounds wired, when I try with the code in my post.

    I get the nodename on the nodes that have umbracoNaviHide set to true. And it´s displays fine on the frontend of my site.

    But you could try what Rich says, and see if you get any data out.

    /Dennis

  • Molly 94 posts 134 karma points
    Jul 02, 2013 @ 11:14
    Molly
    0

    Thank you for your help.

    There must of been a slight spelling out in the title display on my part it is working great now thank you.  

    Would you know about pagination in xslt ? Or is it worth me starting a new topic? I have pagination for my new items but when my news items finish the next button doesn't disappear so it carries on showing empty pages everytime it is clicked.  The test for it looks fine. 

    <xsl:if test="(($pageNumber +1) / $recordsPerPage) &lt; ($numberOfRecords)">

     

    Thanks 

    Molly 

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jul 02, 2013 @ 11:29
    Dennis Aaen
    0

    Hi Molly,

    Good to hear that you manage to solve you, problem.

    I think the best way is to keep one issue on one thread. So my advice would be start a new topic with the pagination question. Then people easier can see what the topic is about and the issue. But when it has been said. (No rule without exception :) )

    Don´t know if you use or have seeen Chrizitan´s pagination in XSLT, I don´t know if this can help you in some way,

    https://github.com/greystate/Greystate-XSLT-Helpers/tree/master/paginationhelper

    /Dennis

  • Laurence Gillian 600 posts 1219 karma points
    Jul 02, 2013 @ 11:33
    Laurence Gillian
    0

    Hi Molly,

    Often the easiest way of solving an XSLT problem is making sure the numbers are right, you could try debugging your pagination quickly...

    Add a textarea and spit out the values...

    <textarea>
    number of records <xsl:value-of select="$numberOfRecords" />, records per page
    <xsl:value-of select="$recordsPerPage" />, etc....
    </textarea> 

    I'd check that $numberOfRecords is correct. 

    It could be that you are counting bits of XML that are 'child' elements of the page. 

    Could be a case of adding a [@isDoc] into your XPATH so you are only counting pages (not MNTP's, DAMP's, etc)

    :) Hope that helps in a round about way! Lau

  • Molly 94 posts 134 karma points
    Jul 02, 2013 @ 11:50
    Molly
    0

    Thanks Dennis, I'll have a look at that link 

    Thanks Laurence, I've just added that textarea and it says i have number of records = 11 and i'm displaying 1 per page. so i added the isDoc (hopefully in the correct way) 

    <xsl:for-each select="$currentPage/newsItem [string(data [@isDoc and @alias='umbracoNaviHide']) != '1']">

    But it still states 11 records 
    Thanks again 
  • Molly 94 posts 134 karma points
    Jul 02, 2013 @ 11:55
    Molly
    0

    Sorry i've done it. Thank you very much. I'd place the [@isDoc] in wrong place. Corrected place 

    <xsl:variable name="numberOfRecords" select="count($currentPage/* [@isDoc])"/>

    I really appreciate everyone's help :D 

     

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jul 02, 2013 @ 11:57
    Dennis Aaen
    0

    Hi Molly,

    Try this one.

    <xsl:for-eachselect="$currentPage/newsItem [@isDoc and string(umbracoNaviHide) != '1']">

    /Dennis

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jul 02, 2013 @ 12:00
    Dennis Aaen
    0

    Okay I was too slow :)

    Good that you find the right XPath Molly.

    /Dennis

Please Sign in or register to post replies

Write your reply to:

Draft