Good morning all, I am working up a way to use the content picker to display certain peices of content that I specify on certain pages.
I have the content picker in place and it will display the content ID of the content that I have chosen with the picker, however I am not sure how to get the HTML of that content rather then the ID.
I am sure it's done with a macro, but I am pretty green with XSLT, so a little push in the right direction would be awesome!
Some ideas:
1. If the selected content node has an associated template that holds the HTML have a look at umbraco.library:RenderTemplate.
I have just finished a modular site were basically all content on the pages is put together from several nodes selected in a few multiple content pickers, one for each column or other content area. This method works well and has the advantage that you do not have to know XSLT to change the HTML output, only HTML and basic master pages syntax to create new alternative templates. The downside is that RenderTemplate cannot handle .NET user controls.
2. Use XSLT only. Get the node XML using umbraco.library:GetXmlNodeById, then use XSLT to traverse the properties and output the HTML.
Good luck!
Be sure to post your findings here so that others can benefit as well!
thanks for your response, but I the problem is I am not sure how to grab the right node in this XSLT? I have tried quite a number of things, but all I am able to get is the contents ID. I was able to get the current pages content as well, but not the correct info. Do you have an example I could work off of?
Here's a quick example: Let's say the the current pages document type has content picker field whose alias is "foreignContent". As Daniel says you can grab datafields from the foreignContent-node by using GetXmlNodeById to get a reference to the foreign node, or you can use a template to render the foreign node via RenderTemplate, the following example does both:
Here's a quick example: Let's say the the current pages document type has content picker field whose alias is "foreignContent". As Daniel says you can grab datafields from the foreignContent-node by using GetXmlNodeById to get a reference to the foreign node, or you can use a template to render the foreign node via RenderTemplate, the following example does both:
[code]
[/code]
Regards
Jesper Hauge[/quote]
This worked great, however I need the content to be HTML on the page rather than encoded HTML text. How might I go about getting it encoded? Here's the example I am working on...
Content Picker HTML
Good morning all, I am working up a way to use the content picker to display certain peices of content that I specify on certain pages.
I have the content picker in place and it will display the content ID of the content that I have chosen with the picker, however I am not sure how to get the HTML of that content rather then the ID.
I am sure it's done with a macro, but I am pretty green with XSLT, so a little push in the right direction would be awesome!
Thanks all!
It is not morning over here, but anyway:
Some ideas:
1. If the selected content node has an associated template that holds the HTML have a look at umbraco.library:RenderTemplate.
I have just finished a modular site were basically all content on the pages is put together from several nodes selected in a few multiple content pickers, one for each column or other content area. This method works well and has the advantage that you do not have to know XSLT to change the HTML output, only HTML and basic master pages syntax to create new alternative templates. The downside is that RenderTemplate cannot handle .NET user controls.
2. Use XSLT only. Get the node XML using umbraco.library:GetXmlNodeById, then use XSLT to traverse the properties and output the HTML.
Good luck!
Be sure to post your findings here so that others can benefit as well!
daniel,
thanks for your response, but I the problem is I am not sure how to grab the right node in this XSLT? I have tried quite a number of things, but all I am able to get is the contents ID. I was able to get the current pages content as well, but not the correct info. Do you have an example I could work off of?
Thanks man!
Kyle,
Here's a quick example: Let's say the the current pages document type has content picker field whose alias is "foreignContent". As Daniel says you can grab datafields from the foreignContent-node by using GetXmlNodeById to get a reference to the foreign node, or you can use a template to render the foreign node via RenderTemplate, the following example does both:
[code]
[/code]
Regards
Jesper Hauge
[quote=jhauge]Kyle,
Here's a quick example: Let's say the the current pages document type has content picker field whose alias is "foreignContent". As Daniel says you can grab datafields from the foreignContent-node by using GetXmlNodeById to get a reference to the foreign node, or you can use a template to render the foreign node via RenderTemplate, the following example does both:
[code]
[/code]
Regards
Jesper Hauge[/quote]
This worked great, however I need the content to be HTML on the page rather than encoded HTML text. How might I go about getting it encoded? Here's the example I am working on...
http://kylepauljohnson.com/default.aspx
Try the disable-output-escaping option on the value-of statement:
[code][/code]
cheers,
doug.
[quote=drobar]Try the disable-output-escaping option on the value-of statement:
[code][/code]
cheers,
doug.[/quote]
Ha, had just found my answer and was returning to post it when I saw you had also provided it. Thanks a lot all! That seemed to fix me up!
is working on a reply...