Copied to clipboard

Flag this post as spam?

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


  • Denis 25 posts 267 karma points
    Oct 03, 2016 @ 10:55
    Denis
    0

    Hello!

    I have created document (Content) with Id = 1234. How can I render it in another template (like widget)?

    Thanks.

  • Dennis Adolfi 1082 posts 6446 karma points MVP 5x c-trib
    Oct 03, 2016 @ 11:02
    Dennis Adolfi
    1

    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

  • Denis 25 posts 267 karma points
    Oct 03, 2016 @ 11:08
    Denis
    0

    Hi, Dennis! This is not that I need. I need a method something like "Umbraco.RenderContent(nodeId)".

  • Dennis Adolfi 1082 posts 6446 karma points MVP 5x c-trib
    Oct 03, 2016 @ 11:13
    Dennis Adolfi
    0

    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.

  • Denis 25 posts 267 karma points
    Oct 03, 2016 @ 11:15
    Denis
    0

    Umbraco.RenderTemplate(nodeId) renders complete page including master layout(s), but I need render only those template, which setted for my content node.

  • Dennis Adolfi 1082 posts 6446 karma points MVP 5x c-trib
    Oct 03, 2016 @ 11:19
    Dennis Adolfi
    0

    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?

  • Denis 25 posts 267 karma points
    Oct 03, 2016 @ 11:26
    Denis
    0

    I have following structure of document types:

    1. Content-Rotator-1:

      1. Slide-1 (assigned to Template-1)
      2. Slide-2 (assigned to Template-2)
      3. Slide-3 (assigned to Template-3)
      4. Slide-4 (assigned to Template-4)
      5. Slide-5 (assigned to Template-2)
    2. Content-Rotator-2:

      1. Slide-1 (assigned to Template-3)
      2. Slide-2 (assigned to Template-2)
      3. Slide-3 (assigned to Template-1)
      4. Slide-4 (assigned to Template-4)
      5. Slide-5 (assigned to Template-4)

    ... 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).

  • Dennis Adolfi 1082 posts 6446 karma points MVP 5x c-trib
    Oct 03, 2016 @ 11:39
    Dennis Adolfi
    0

    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!

  • Denis 25 posts 267 karma points
    Oct 03, 2016 @ 11:39
    Denis
    100

    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.

  • Dennis Adolfi 1082 posts 6446 karma points MVP 5x c-trib
    Oct 03, 2016 @ 11:40
    Dennis Adolfi
    1

    Okay, awesome Denis. Glad it worked out for you.

    Have a great day!

  • Semyon Vyskubov 7 posts 117 karma points
    Aug 01, 2017 @ 15:23
    Semyon Vyskubov
    0

    I had to do exactly the same, but I want to keep initial Layout value. Do you foresee any solutions in this case?

Please Sign in or register to post replies

Write your reply to:

Draft