Copied to clipboard

Flag this post as spam?

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


  • Tom Engan 430 posts 1173 karma points
    May 06, 2015 @ 13:15
    Tom Engan
    0

    Caching problem?

    In document type I've created a true/false property (fwbgCarousel) that shall initialize the bootstrapcarousel as a full width carousel (or just a carousel in the grid)

    The template:

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @using ClientDependency.Core.Mvc
    @{
        Layout = "Master.cshtml";
        Html.RequiresCss("~/css/bootstrap.min.css");
        Html.RequiresCss("~/css/font-awesome.min.css");
        Html.RequiresCss("~/css/rte.css");
        Html.RequiresCss("~/css/style.css");
        Html.RequiresCss("~/css/carousel.css");
    }

    @{
        if (uQuery.GetCurrentNode().GetAncestorOrSelfNodes().Any(x => x.GetProperty("fwbgCarousel")))
        {
            Html.RequiresCss("~/css/fwbgcarousel.css");
        }
    }

    @CurrentPage.GetGridHtml("content", "bootstrap3")

     

    But the problem is, when I use the same template in content, and some pages shall have full width, and most of the pages not shall have full width (on/off), this true/false settings don't seem to read fwbgCarousel property for every page, but hang and don't refresh the template for every page.

    The <link href="/css/fwbgcarousel.css?cdv=1570503641" type="text/css" rel="stylesheet"/> text don't change/disappear for every new page recalled from this template.

    What is the solution here?

     

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    May 06, 2015 @ 15:39
    Alex Skrypnyk
    100

    Hi Tom,

    Why did you use .GetAncestorOrSelfNodes().Any() ?

    Try just current page:

    if (uQuery.GetCurrentNode().GetProperty("fwbgCarousel") != null && uQuery.GetCurrentNode().GetProperty("fwbgCarousel").Value.Equals("1"))
    

    Thanks, Alex

  • Tom Engan 430 posts 1173 karma points
    May 06, 2015 @ 16:06
    Tom Engan
    0

    Just because I find 3 examples here: https://our.umbraco.org/forum/developers/razor/43529-Recursive-usage-of-data-type-TrueFalse, and that was the only one who work without modifications.

    But your solution works for me, so this is absolutly perfect. THANKS! :-)

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    May 06, 2015 @ 16:07
    Alex Skrypnyk
    0

    You are welcome ))

  • 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