Umbraco.RenderTemplate(nodeId) renders complete page including master layout(s), but I need render only those template, which setted for my content node.
Content rotator have it's own template.
Slide can have different templates.
So I want to render all slides of single Content-Rotator in single template.
For this I need some method, which can render single node (slider in my case).
Its not a "traditional" setup i would say, (but hey, whats traditional anyways? :)) Usally you´d assign templates for your pages, i.e nodes that you can browse in to directly. And then you´d treat your widgets (in your case the slideshows) as plain nodes without templates, and then render them with a partial view on the pages template. Thats probobly why there is no Umbraco method for RenderContent without Master, because its probobly not a common setup.
Also, maybe have a look at any of the starterkits avalible and se how they handle templates, widgets and partialviews. There is a pretty new starterkit avaible: https://our.umbraco.org/projects/starter-kits/umazel-starter-kit-responsive-bootstrap-theme/ that is really well structured and programmed, have a look at that and see if you can find a solution to your problem.
Render document
Hello!
I have created document (Content) with Id = 1234. How can I render it in another template (like widget)?
Thanks.
Hi Denis.
Have a look at this documentation:
Creating (Editing) Your First Template https://our.umbraco.org/documentation/tutorials/creating-basic-site/creating-your-first-template-and-content-node
Hi, Dennis! This is not that I need. I need a method something like "Umbraco.RenderContent(nodeId)".
Ok, so i might not fully understand your question, sorry for that.
When you say that you need to "render content" what exacly do you mean? Do you mean rendering properties from your Node on the template?
Please provide as much information as you can and I will do my best to try and help you.
Umbraco.RenderTemplate(nodeId) renders complete page including master layout(s), but I need render only those template, which setted for my content node.
Looking at the docs for UmbracoHelper there does´nt seem to be a method for rendering a content node like that without the master. https://our.umbraco.org/documentation/reference/querying/umbracohelper/
Maybe you should consider rendering a PartialView for that node instead instead?
I have following structure of document types:
Content-Rotator-1:
Content-Rotator-2:
... and so on.
Content rotator have it's own template. Slide can have different templates.
So I want to render all slides of single Content-Rotator in single template. For this I need some method, which can render single node (slider in my case).
Okay, i think i understand you better now.
Its not a "traditional" setup i would say, (but hey, whats traditional anyways? :)) Usally you´d assign templates for your pages, i.e nodes that you can browse in to directly. And then you´d treat your widgets (in your case the slideshows) as plain nodes without templates, and then render them with a partial view on the pages template. Thats probobly why there is no Umbraco method for RenderContent without Master, because its probobly not a common setup.
I really think you should have a look at the docs i sent in my first email, where they explain a Umbraco website build: https://our.umbraco.org/documentation/Tutorials/Creating-Basic-Site/
Also, maybe have a look at any of the starterkits avalible and se how they handle templates, widgets and partialviews. There is a pretty new starterkit avaible: https://our.umbraco.org/projects/starter-kits/umazel-starter-kit-responsive-bootstrap-theme/ that is really well structured and programmed, have a look at that and see if you can find a solution to your problem.
Sorry i could´nt be of anymore help.
Take care!
SOLVED!!!
For my case template, which I want to render must have Layout setted to null. And then I can call Umbraco.RenderTemplate(nodeId) to get html.
Thanks.
Okay, awesome Denis. Glad it worked out for you.
Have a great day!
I had to do exactly the same, but I want to keep initial Layout value. Do you foresee any solutions in this case?
is working on a reply...