Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Sorry if I am bombarding the forum, lost of newbie questions I'm afraid.
I want to have section of content that can be edited by my users but the content in itself is not a page.
For example, it could be contact details that would appear in the footer of every page. I could easily hard code this into the footer of the template but that way a user couldn't edit the details if the need arose.
Can I give them a section where they can edit snippets of content that can then appear at various places throughout the site?
Create doctype - UserEditableContatWrapper. Under that add doctype with properties you want, like a textstring, call it footerText.
Add property umbracoNaviHide and set it, so it won't be rendered in menu.
In template render it.
Hope somebody could better explain it to you.
Here is the way how I would solve this. I assume that you have a frontpage document type (http://umbraco.tv/videos/umbraco-v7/implementor/fundamentals/document-types/what-is-a-document-type/)
On the frontpage document type I would create a tab called site settings. In there I would add fields for the address. It could be text strings data types or it could be one multiple textbox. http://umbraco.tv/videos/umbraco-v7/implementor/fundamentals/document-types/properties/ and http://umbraco.tv/videos/umbraco-v7/implementor/fundamentals/document-types/data-types/
Then you would need to get the data out in your template, this can simple be done using this.
@Umbraco.Field("propertyAlias", recursive: true)
You will need to change the propertyAlias to your alias of the field that you want to pull out
It´s also on the site settings tab I would add e.g Google analytics id field and stuff like that.
Hope this helps,
With that option, do all other doctypes have to inherit from the frontpage?
No, they sould not in inherit, the recursive: true goes up in the content tree until it finds the field, and the field has a value.
Try to see this videos as well, I am sure that they can help you too.
I'll give that a whirl, thanks.
That worked perfect. Quick question though, how would I do the same thing with an image? If I had a media picker on the homepage that represents a banner image?
i've been using this to get it once:
<img src="@Umbraco.Media(CurrentPage.bannerImage).Url" ...
If you want to use the a media picker on the homepage, then you can get the image using this Razor.
var bannerImage = Umbraco.Media(CurrentPage.bannerImage);
<img src="@bannerImage.umbracoFile alt="@bannerImage.Name" />
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted