1

Am using N2 CMS and want to know how I can create an editable item that can be included in the header of every page within the site.

I just want to be able to edit this piece of text in one place and have the text appear on every page.

I understand that I need to create a "Part" but I'm not sure how to create the edit interface for this one "part"

Thanks.

BigJump
  • 15,561
  • 3
  • 31
  • 29
FloatLeft
  • 1,317
  • 3
  • 23
  • 40

3 Answers3

2

Late answer but IT might help the others. You can use it as following.

@{ Html.DroppableZone(Content.Traverse.StartPage, "EDITABLEPART").Render(); }
eadam
  • 23,151
  • 18
  • 48
  • 71
  • Note that [link-only answers are discouraged](http://meta.stackoverflow.com/tags/link-only-answers/info), SO answers should be the end-point of a search for a solution (vs. yet another stopover of references, which tend to get stale over time). Please consider adding a stand-alone synopsis here, keeping the link as a reference. – kleopatra Dec 24 '13 at 10:32
1

A simpler approach (to parts) might be to:

  1. add a property to your homepage ContentItem which is decorated with EditableTextBox or EditableFreeTextBox.
  2. edit the homepage to set the text
  3. then in your layout/masterpage you can simply include the output from this property

We use this technique for storing the Google Analytics tracking code against the homepage and it then gets rendered on every page.

BigJump
  • 15,561
  • 3
  • 31
  • 29
0

It sounds like you need a recursive zone. Here's an example: https://github.com/jamestharpe/HereSay/blob/master/src/HereSay/Decorators/SectionalZoneDecorator.cs

Using that code, all you need to do is name your zone beginning with "Sectional" (e.g. "SectionalTopZone") and the plug-in will take care of the rest.

For an example of an editable part, you can take a look at the code here: https://github.com/jamestharpe/HereSay/blob/master/src/HereSay/Parts/HtmlContentBlock.cs

James
  • 697
  • 5
  • 23