Copied to clipboard

Flag this post as spam?

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


  • Simon 17 posts 37 karma points
    Apr 10, 2012 @ 15:51
    Simon
    0

    Using the uComponents TextString Array

    Hi

    I'm using the TextString Array to store an array of values eg Name/Address/Tel num.

    What's the simplest way to display all the values in the array in a template?

    Can I directly reference individaul members?

    Do I need to use a macro or can I loop through the array directly in a template?

    I'm on umbraco 4.7.1

    Thanks

  • Lee Kelleher 4026 posts 15837 karma points MVP 13x admin c-trib
    Apr 10, 2012 @ 16:48
    Lee Kelleher
    0

    Hi Simon,

    The data for Textstring Array is stored as XML:

    <TextstringArray>
        <values>
            <value>hello</value>
            <value>world</value>
        </values>
        <values>
            <value>foo bar</value>
            <value>world</value>
        </values>
    </TextstringArray>

    If you are using XSLT, then you can loop through each of the "values":

    <xsl:for-each select="*/TextstringArray/values">
        <strong><xsl:value-of select="value[1]" /></strong>
        <xsl:value-of select="value[2]" />
    </xsl:for-each>

    If you are using Razor, I'm not 100% sure, think you can loop through using DynamicXml, but I haven't tried that myself.

    Cheers, Lee.

  • Simon 17 posts 37 karma points
    Apr 11, 2012 @ 16:52
    Simon
    0

    Brilliant, thanks.

  • 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