Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ault Nathanielsz 71 posts 317 karma points c-trib
    Nov 24, 2017 @ 12:29
    Ault Nathanielsz
    0

    NewB: Models and Composite Doctypes

    Here is an oversimplification of my problem:

    Doctypes:

    • TitlesAndDescriptons - component for composite doctypes
    • ImagesAndContent - component for composite doctypes
    • Home (composite of both of the above)
    • Projects (composite of both of the above)
    • Project (composite of both of the above another Tab

    Templates:

    • sitelayout (master template)
    • home
    • projects
    • Project

    Issue: If my master template (sitelayout) begins with:

    @inherits UmbracoViewPage< ContentModels.Home > @using ContentModels = Umbraco.Web.PublishedContentModels;

    it only works for the home page... What model do I need to reference so that all my pages can use the same master template?

    FWIW I am using the AppData ModelsMode

  • Matt Darby 28 posts 389 karma points c-trib
    Nov 24, 2017 @ 12:47
    Matt Darby
    0

    Hey Ault,

    On your master template you don't need to pass in a model. For example just:

    @inherits Umbraco.Web.Mvc.UmbracoViewPage
    
  • Ault Nathanielsz 71 posts 317 karma points c-trib
    Dec 01, 2017 @ 12:45
    Ault Nathanielsz
    0

    If I do not specify a model, I get a compilation error.

    Namely: 'Umbraco.Core.Models.IPublishedContent' does not contain a definition for the name of the doctype property (e.g. "title") that I am trying to call.

    As soon as I specify a model, everything works great - until I try to use it with another doctype.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies