Copied to clipboard

Flag this post as spam?

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


  • pikej 27 posts 47 karma points
    May 11, 2011 @ 10:35
    pikej
    0

    checkbox XSLT loop

    Hi,

    is there any way to display pages that have got checkbox property marked?

    I have a site with video games and would like to have a section "upcoming titles". so if I mark checkbox that game would go to "upcoming titles" and if it is unmarked that means it is published now and goes back to other part of the website (where already published games are).

    there is also url problem, ideally I would like to have just one url for each game no matter if it is published or not like http://siteneme.com/games/packman.aspx

    How to implement all this?

    thanks in advance 

  • Samuel Hamer 44 posts 66 karma points
    May 11, 2011 @ 10:53
    Samuel Hamer
    1

    Selecting documents in xslt that have a checkbox ticked or not using a macro is a doddle;

     

    <xsl:for-each select="$currentPage/game[PublishedCheck='1']">
    <xsl:for-each select="$currentPage/game[PublishedCheck='0']">

    (Or something like that)

    but are you saying you need the document itself to actually move location within the site (say from a folder marked coming soon to a folder marked published) if a checkbox is ticked?  If so I would repost this in the API forum as you cannot achieve that in xslt.

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    May 11, 2011 @ 11:03
    Lee Kelleher
    0

    Hi pikej,

    Since we don't know anything about your doc-type names, etc - there'll be guesswork with my example.

    Quick example of a conditional XSLT for-each loop ... e.g. that is only displays nodes with a specific set value.

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

    This assumes that your doc-type for a game is called "VideoGame" and the checkbox property is called "upcomingTitle".

    If you need a fuller example, then post a code snippet of your XSLT, then we can help you achieve what you need.

    Cheers, Lee.

Please Sign in or register to post replies

Write your reply to:

Draft