Sure,
I want editors to be able to modify the footer content of the entire web site (which is the same on all pages) without leaving the Content section of BackOffice.
So if I'm understanding this correctly, we would usually do this within a Settings tab setup on the homepage. So, on your homepage document type, you might create a Footer Text field, for example. Then all you need to do is get the homepage and the property from their. An easy way to get the homepage on a single-site installation can be:
Close...I want to do something like this on my master template...
@*place the following condition on my master template*@
IPublishedContent homepageItem = //get property alias "myText" that was created on the home document type.
@if (homepageItem != null)
{
<p>@homepageItem</p>
}
That's what I am shooting for, but do not know how to write with IPublishedContent.
Thanks Dan!
and taking it just one step further, what if I simply wanted to reference a property alias from the home page (i.e. a rich text editor that has a property alias called my text). How can I call just that, onto other sibling templates?
I apologize, this should of been my original question.
Content Node data to Partial View
Is it possible to call content out of a specific content node and load it into a partial view?
My goal to have an editor to create content from a content node, which then I can make global by referencing it into a partial view.
If this is possible is there an online resource in achieving this?
Many thanks!
Hi blackhawk,
I'm not sure there's quite enough detail here to figure out what you're doing, any chance you could you elaborate on the end goal here?
Sure, I want editors to be able to modify the footer content of the entire web site (which is the same on all pages) without leaving the Content section of BackOffice.
Thanks blackhawk,
So if I'm understanding this correctly, we would usually do this within a
Settings
tab setup on the homepage. So, on your homepage document type, you might create aFooter Text
field, for example. Then all you need to do is get the homepage and the property from their. An easy way to get the homepage on a single-site installation can be:You'd probably want to null check it when making use of it too:
Hope I understood correctly and that helps.
Close...I want to do something like this on my master template...
That's what I am shooting for, but do not know how to write with IPublishedContent.
An alternative way to get the homepage content (which also works when you have multiple home pages is):
or in more recent versions of Umbraco, simply:
Thanks Dan! and taking it just one step further, what if I simply wanted to reference a property alias from the home page (i.e. a rich text editor that has a property alias called
my text
). How can I call just that, onto other sibling templates?I apologize, this should of been my original question.
So, once you have your
homePage
variable populated then you can access properties as you would Model.Content (it's allIPublishedContent
) ie.If your property was a string you would use:
Bingo! Thank you. That is exactly what I was looking for!
is working on a reply...