Copied to clipboard

Flag this post as spam?

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


  • Simeon Ostberg 123 posts 389 karma points
    Apr 20, 2018 @ 10:27
    Simeon Ostberg
    0

    Blog function of standard template

    Hey guys,

    I would like to use the blog function of the standard template in my template. And although I use the exact same code, it does not work in my template.

    I always get this error message: "Compiler Error Message: CS1061: 'Umbraco.Web.PublishedContentModels.Blog' does not contain a definition for 'howManyPostsShouldBeShown' and no extension method 'howManyPostsShouldBeShown' accepting a first argument of type 'Umbraco.Web.PublishedContentModels.Blog' could be found (are you missing a using directive or an assembly reference?)"

    The code is:

    @Umbraco.RenderMacro("latestBlogposts",
    Line 13:                      new
    Line 14:                      {
    Line 15:                          numberOfPosts = Model.Content.howManyPostsShouldBeShown,
    Line 16:                          startNodeId = Model.Content.Id
    Line 17:                      })
    

    Unfortunately I'm lost at this point.

    Does anyone havean idea? Thanks a lot! Simeon

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Apr 20, 2018 @ 10:41
    Alex Skrypnyk
    0

    Hi Simeon

    Do you have a property "howManyPostsShouldBeShown" in the node?

    Alex

  • Simeon Ostberg 123 posts 389 karma points
    Apr 20, 2018 @ 10:49
    Simeon Ostberg
    0

    Hi Alex,

    Yes, built exactly like in the standard template with a slider.

    Simeon

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Apr 20, 2018 @ 11:05
    Alex Skrypnyk
    0

    First of all, rename it to "HowManyPostsShouldBeShown"

    And try to rebuild Models builder models

  • Simeon Ostberg 123 posts 389 karma points
    Apr 20, 2018 @ 11:23
    Simeon Ostberg
    0

    First is done. How do I rebuild Models builder models?

    At Developer => Models Builder I can only see the settings and have a "Reload" button.

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Apr 20, 2018 @ 11:25
    Alex Skrypnyk
    0

    Then change settings in web.config -> appSettings -> Umbraco.ModelsBuilder.ModelsMode set to Dll

    And go to At Developer => Models Builder

  • Simeon Ostberg 123 posts 389 karma points
    Apr 20, 2018 @ 11:44
    Simeon Ostberg
    0

    This doesn't exist in the web.config.

  • Nik 1614 posts 7260 karma points MVP 7x c-trib
    Apr 20, 2018 @ 14:20
    Nik
    0

    Hi Simeon,

    What version of Umbraco are you using?

    Thanks,

    Nik

  • Simeon Ostberg 123 posts 389 karma points
    Apr 20, 2018 @ 14:27
    Simeon Ostberg
    0

    Hi Nik,

    We run on 7.9.2.

    Simeon

  • Simeon Ostberg 123 posts 389 karma points
    Apr 20, 2018 @ 15:24
    Simeon Ostberg
    0

    One more thing: If I take this

    numberOfPosts = Model.Content.howManyPostsShouldBeShown
    

    out and replace it with a defined number, like so

    numberOfPosts = 3,
    

    it works.

    Does this help?

    Simeon

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Apr 20, 2018 @ 15:33
    Alex Skrypnyk
    0

    The issue is with "Model.Content.HowManyPostsShouldBeShown" field, I think it's not presented in Model.Content

    Are you sure that current page has this field?

  • Simeon Ostberg 123 posts 389 karma points
    Apr 23, 2018 @ 10:53
    Simeon Ostberg
    0

    Hi Alex,

    Yes, I'm sure. At least, I hope. I have two document types: "blog" and "blogpost". "blogpost" is a child of "blog". In "blog" I have the field. No typos or anything..

    Simeon

Please Sign in or register to post replies

Write your reply to:

Draft