Copied to clipboard

Flag this post as spam?

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


  • Danne Borell 7 posts 27 karma points
    Sep 23, 2010 @ 15:06
    Danne Borell
    0

    Checking for type on properties

     

    Is it possible to check for type on properties?

    I have several content pickers on a page and I would like to do a for-each loop which only selects them and ignores the other properties.

    Or is there another way of doing this?

    I'm using 4.5.2

     

    /Danne

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Sep 23, 2010 @ 16:41
    Dirk De Grave
    0

    Hi Danne,

    Could you give some more background info? Page? Do you mean in page in the backoffice admin or front end page? Or from xslt? 

    It is possible to check for what type of property you're dealing with, but it'll involve some db queries which may be of some overhead when used on the frontend.

    Anyway, let us know what exactly you're trying to do.

     

    Cheers,

    /Dirk

  • Danne Borell 7 posts 27 karma points
    Sep 23, 2010 @ 16:56
    Danne Borell
    0

    Sorry, the properties lie on the homepage of the page. I'm using a xslt-macro for getting the info from them and displaying it.
    I've been trying to find a way of doing this in xslt, but I could propably do it in .NET if that works better, though I haven't tried using it with umbraco yet.

    Hope that makes it clearer.

    /Danne

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Sep 23, 2010 @ 20:26
    Dirk De Grave
    0

    well, I guess it'll be easier if you'd use .net for that, but would still be worried by the performance hit, as you'll have to iterate all properties, check what type of property it is (which would require lots of db queries - which should be avoided on the frontend) and then use that info to display data (no additional performance overhead as it doesn't involve db querying)

    One alternative would be to pass in the names of the properties (that are of the content picker type) to the xslt via macro properties (eg a comma separated list, which you can then retrieve in your xslt and iterate over. Don't have an example on that, but I'm sure others can chime in and add some more stuff to get you started.

     

    Hope this helps.

    Cheers,

    /Dirk

     

  • Danne Borell 7 posts 27 karma points
    Sep 24, 2010 @ 13:48
    Danne Borell
    0

    Hmm, yeah it wouldn't be worth lowering performance over. I've got the page working, it's just that I would have prefered if the code could handle it if more content pickers were added to the page by users without me having to change it. That's why I wanted to go by type instead of just using the names of the pickers.

    But thanks anyway, it feels like I'm beginning to come to grips with umbraco, and just finished my first page with some help from people on the forum, so things are looking up :-)

    /Danne

Please Sign in or register to post replies

Write your reply to:

Draft