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.
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.
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.
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 :-)
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
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
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
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
-
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
is working on a reply...