Copied to clipboard

Flag this post as spam?

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


  • Eric Herlitz 97 posts 129 karma points
    Mar 26, 2011 @ 18:44
    Eric Herlitz
    0

    List values from custom data type in macro

    Hi

    I have created some categories in a custom data type, see image below

    Is it possible to list theese values (programmatically) through a macro or in a template somehow?

    Thanks

  • rorythecheese 110 posts 56 karma points
    Mar 27, 2011 @ 15:47
    rorythecheese
    0

    Yep you can access it by finding out the datatype's id - by hovering over the datatype in the tree and checking the url displayed in the status bar at the footer of the browser.

    It should read something like

    javascript:openDataType(1023)

    Then take that id and you can use it as follows in an xslt macro

     

    <xsl:for-each select="umbraco.library:GetPreValues(1023)//preValue">
       
    <xsl:value-of select="." /><br/>
    </xsl:for-each>

    The xml you transform will be something like this

    <preValues>
       <preValue id="10">PHP</preValue>
       <preValue id="11">Joomla</preValue>
       <preValue id="12">SQL Syntax</preValue>
    </preValues>


     

     

     

     

     

     

     

     

     

     

  • Eric Herlitz 97 posts 129 karma points
    Mar 27, 2011 @ 16:18
    Eric Herlitz
    0

    Brilliant, thank you very much!

Please Sign in or register to post replies

Write your reply to:

Draft