ok made some progress tonight...i have the vacancy displaying the ID's of the candidates that I have associated via teh relaion pickers. Show below. From here I am usure how to display the properties of the candidate and link through to a detail page..
What does your current code look like? You will need to get the content by the id in the comma seperated list. So you will probably need to Split the string that returns the id's and then loop over each of the id's and fetch the content based on the id.
Ok, well that is expected as well since it's only the ID's that are stored in the "candidates" filed and you'll then need to look them up as I described above.
I have not been using the MultiPicker relations picker myself so I don't know what it returns XML wise if you choose to render it using XSLT. But I suspect it may just return a comma seperated list of the id's...
so in XSLT you should be able to do something like
<!-- Let's fetch the id's -->
<xsl:variable name="ids" select="umbraco.library:Split($currentPage/candidates,',')" />
Now that you have split the id's then you should be able to loop over the returned
Does this make sense? Or do you need a bit more in order to get started - This should of course be written in an XSLT macro :)
Here is the finished code if anyone is interested.. really enjoyed finding out about relations in Umbraco...all new to me and pretty powerfull. Even managed to combine the UMB Vimeo video picker into the code. Inspired me to write a blog post about how to do this as there are very few exmaples of how to use relations etc out there.
Which gives me the following result. Looking to now extend this to inculude the ability to "like" or "Favourite" a candidate again using relations in some way.
Display content from MultiPicker Relations in Template
Finally got my head round MultiPicker Relations and how I can use them to get the Many to Many relationship I need, as dicussed in this forum post.
I cant seem to find any examples of how i would display the content which has been selected (via the picker) in a template.
As with most things i would want to display an overview and a detail view of the selected items.
S
Hi Stephen
Don't know if this article can help a bit http://24days.in/umbraco/2012/who-picked-this/
But you should be able to retrieve some data by rendering the name of your relationspicker alias, which you have setup on the document type I guess?
/Jan
Thanks (again!) Jan...
S
Hi Stephen
You're welcome - Did it help any?
/Jan
Not sure yet...trying it out tonight...not enough time in the daytime!
ok made some progress tonight...i have the vacancy displaying the ID's of the candidates that I have associated via teh relaion pickers. Show below. From here I am usure how to display the properties of the candidate and link through to a detail page..
Hi Stephen
What does your current code look like? You will need to get the content by the id in the comma seperated list. So you will probably need to Split the string that returns the id's and then loop over each of the id's and fetch the content based on the id.
Depending on whether you're using Dynamic Razor or Strongly typed you need to use either @Umbraco.Content() or @Umbraco.TypedContent() - You can probably benefit from using the Razor cheat sheet here https://our.umbraco.org/projects/developer-tools/umbraco-v6-mvc-razor-cheatsheets
Hope this helps.
/Jan
Not sure if this is what you mean...I'm using 6.1.3 and have a mix od razor and XSLT but will probably opt for Razor on this one.
Hi Stephen
I'm mean the code...which you use to render the view you posted a screendump of in your previous post - It will help to see your XSLT/Razor code :)
What version of Umbraco are you using btw?
/Jan
Hi Stephen
Ok, well that is expected as well since it's only the ID's that are stored in the "candidates" filed and you'll then need to look them up as I described above.
I have not been using the MultiPicker relations picker myself so I don't know what it returns XML wise if you choose to render it using XSLT. But I suspect it may just return a comma seperated list of the id's...
so in XSLT you should be able to do something like
Now that you have split the id's then you should be able to loop over the returned
Does this make sense? Or do you need a bit more in order to get started - This should of course be written in an XSLT macro :)
/Jan
Yip great info, I'll report back with the result.
S
Sounds good Stephen, looking forward to see what you come up with :)
/Jan
Here is the finished code if anyone is interested.. really enjoyed finding out about relations in Umbraco...all new to me and pretty powerfull. Even managed to combine the UMB Vimeo video picker into the code. Inspired me to write a blog post about how to do this as there are very few exmaples of how to use relations etc out there.
Which gives me the following result. Looking to now extend this to inculude the ability to "like" or "Favourite" a candidate again using relations in some way.
Hi Stephen
Happy to see you managed to get it all working and awesome that you want to blog about it too :)
Remember to mark the issue as solved as well.
Happy writing (The blogpost)
/Jan
is working on a reply...