This is very much possible.
It is hard to explain how without knowing your project structure.
But I think my best solution would be if you want to render data from a node that is the only node of a certain doctype that could be named contactPage, I would do something a like this:
my situation is strange because I know what the problem is, but how to solve it...
I have a master template with a navbar and footer, they render text content like this:
@Model.Value("alias")
from a "home page" doctype
that home page doctype has its own template that inherits from the master
and my contact page is the same, doctype with a template that inherits from the master, but now when a different page gets rendered, it runs through the master template and finds that the specified aliases are not in the doctype, because it is obviously in the home page doctype...
This may seem very confusing, but my goal is just to have the navbar and footer content be rendered
rendering content from different doctype
Hello everyone,
I've been searching the web but did not find anything so this is my last resort...
I want to be able to render content in a template from a different doctype
so for example let's say I have a doctype named "Home" and its corresponding template, to render I would say
I want to know if a can do that, but render from another page, so for example in my Home template render content from the "contact us page"
something like(in-home template):
I hope this makes sense, and thank you in advance
Hi Kyle
This is very much possible. It is hard to explain how without knowing your project structure.
But I think my best solution would be if you want to render data from a node that is the only node of a certain doctype that could be named contactPage, I would do something a like this:
You can even make it typed with
to be able to use contactPage.Alias
I hope you will be able to solve your problem now.
Best regards Frank
Hi Frank, thanks for the reply,
my situation is strange because I know what the problem is, but how to solve it...
I have a master template with a navbar and footer, they render text content like this:
from a "home page" doctype
that home page doctype has its own template that inherits from the master
and my contact page is the same, doctype with a template that inherits from the master, but now when a different page gets rendered, it runs through the master template and finds that the specified aliases are not in the doctype, because it is obviously in the home page doctype...
This may seem very confusing, but my goal is just to have the navbar and footer content be rendered
Hi Kyle
Okay I think I understand. So you need to get the model with the values for the navbar. If it is the root node, you can just use:
If it is not the root node, you need to find it by doctype, like my previous answer:
If you have navbar and footer in seperate partial view files, you can render them like this:
or like this:
I hope that makes good sense to you.
Best regards Frank
Thank you so much!
did the trick for me
is working on a reply...