Quantcast
Channel: Using Optimizely Platforms
Viewing all articles
Browse latest Browse all 8020

best way to create a hello world block?

$
0
0

Following the official episerver documentation, there is a guide to how to create a new page.  There seems to be nothing similar on how to create a block.  I have also read "the missing manual" which is also missing this information.

I am guessting I need 3 files:

  1. Models/Blocks/MyBlock.cs
  2. Controllers/MyBlock.cs
  3. Views/MyBlock.cshtml

In VS, if I "add new" and select the epiplugin, I see:

  • Block Type (is this the model?)
  • Block controller(MVC)  
  • Block partial View (MVC razor)
  • etc.

I assume block type = model, block controller = conroller, and block partial view = view.

This seems to work - I can create a insatance f MyBlock in the CMS editor.

How do I put an area on a page which this block can be added? I cant find this in the docs.

I found this snippet in the missing manual, and put this on my hello world page model, but it doesnt work (nothing shown, only my existing title and body strings). I also tried creating a new page with my single page type, but still no content block where I can drag a block.  What am i missing?

        [Display(
Name = "Main Content Area",
GroupName = SystemTabNames.Content,
Order = 200)]
        public virtual ContentArea MyContentArea { get; set; }
    }

Viewing all articles
Browse latest Browse all 8020

Trending Articles