Copied to clipboard

Flag this post as spam?

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


  • Sam 184 posts 209 karma points
    Feb 13, 2011 @ 14:56
    Sam
    0

    Create a list with values from name field - true/false

    Hi everyone,

    I am trying to end up with this:

    <ul>

    <li>Photo gallery</li>

    <li>Latest news</li>

    </ul>

    which would be generated through true/false selection. ie in the content area there would be ' Photo gallery ( ) and Latest news ( )'. ( ) = a check box.

    I need to apply a default value (or use the field name is that's possible?) to the box which displays if the box is ticked.

    string(umbracoNaviHide) != '1'

    If 1, displays, if boxed is checked, does not display. Any ideas? Thanks in advance.


    Sam.

  • Kim Andersen 1447 posts 2197 karma points MVP
    Feb 13, 2011 @ 15:57
    Kim Andersen
    0

    Hi Sam

    Could you maybe show us the XSLT that you've got so far? And what the output of that XSLT is.

    /Kim A

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Feb 13, 2011 @ 15:58
    Jan Skovgaard
    0

    Hi Sam

    Do you need to make sure some boxes are displayed on certain pages or what is your need exactly? I've read your post a couple of times and I'm not quite sure what it is you're after.

    I don't think you should rely on the umbracoNaviHide for anything else than to decide whether or not a page should shown in navigation or not. But it does of course depend on what it is you're trying to do ;-)

    /Jan

  • Sam 184 posts 209 karma points
    Feb 13, 2011 @ 16:40
    Sam
    0

    I haven't managed to get anything displayed yet. What I want to do is when I create a new portfolio page, the page has standard fields like page title, body text, image to use etc. I also want to add a bunch of check boxes which will have names like Photo gallery, latest news, upcoming events. I will check the box next to each of these features that are on the site that I am creating a page about. Once the page is published, under a heading of 'Website features' will be the list, which is made up of the items I have selected.amic list depending on what the user selects.

    ie something like this;

    <ul>

    <xsl:if test="$currentPage/self::*[isDoc and string(photoGallery) != '1']">
    <li><xsl:value-of select="photoGallery" /></li>
    </xsl:if>

    <xsl:if test="$currentPage/self::*[isDoc and string(latestNews) != '1']">
    <li><xsl:value-of select="latestNews" /></li>
    </xsl:if>

    </ul>

     

    If that helps :)


    Sam.

     

     

     

  • Kim Andersen 1447 posts 2197 karma points MVP
    Feb 14, 2011 @ 20:13
    Kim Andersen
    1

    Maybe this will help you Sam:

    <ul>

    <xsl:if test="$currentPage/photoGallery = '1']">
    <li>Photo Gallery</li>
    </xsl:if>

    <xsl:if test="$currentPage/latestNews = '1']">
    <li>Latest News</li>
    </xsl:if>

    </ul>

    Then we just check to see if any of the two checkboxes are checked, and if so there will be rendered a li-element.

    /Kim A

  • Sam 184 posts 209 karma points
    Feb 14, 2011 @ 20:22
    Sam
    0

    Thanks Kim,

    Sadly, yes, it was just as easy as that, I've been 'working on it' for about an hour :(

    However I did work it out :) and was just about to post, never realised you'd answered it!

    <ul class="generic-list">
      <xsl:if test="$currentPage/umbracoContentManagement != '0'">
      <li>Umbraco content managementli>
    xsl:if>
        <xsl:if test="$currentPage/latestNews != '0'">
      <li>Latest newsli>
    xsl:if>
        <xsl:if test="$currentPage/upcomingEvents != '0'">
      <li>Upcoming eventsli>
    xsl:if>
        <xsl:if test="$currentPage/photoGallery != '0'">
      <li>Photo gallery<li>
    xsl:if>
    ul>

    So, if I now tick all four, this renders:

    <ul class="generic-list">
    <li>Umbraco content management</li>
    <li>Latest news</li>
    <li>Upcoming events</li>
    <li>Photo galleryt</li>
    </ul>

    High five for obvious solutions! :) I did actually want to render the value of the checkbox, the 'Name' field but didn't get that far. This is my simple version of adding a 'tag'. I wanted to develop it into links to so when the box is checked it adds a link. Starting simple!

    Sam.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies