Copied to clipboard

Flag this post as spam?

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


  • Graeme 3 posts 23 karma points
    May 15, 2014 @ 10:18
    Graeme
    0

    Add the slider to an already existing cshtml header script file?

    Hi Im trying to replace a static header image with a slider, which is part of an already existing cshtml header script file. I can only find info about XSLT files 

    Any idea? The site is running on version 4.8.0

    Thanks

  • Alex Skrypnyk 6150 posts 24110 karma points MVP 8x admin c-trib
    May 15, 2014 @ 11:29
    Alex Skrypnyk
    0

    hi Graeme,

    Could you show your templates? You can use your master pages, I think.

    Thanks, Alex

  • Graeme 3 posts 23 karma points
    May 16, 2014 @ 11:34
    Graeme
    0

        Hi Alex, I want to replace the splash image part of this banner block with the slider which is part of the header.cshtml file.  This is referenced in the header macro which in turn is referneced in the 'page' template. Thanks for your help

    <!-- banner starts -->
        <div class="banner_block">
    @{
        var cacheKey = "weatherFeed_" + Util.GetCurrentLanguage();
        var cacheMins = Util.GetInt32AppSetting("weatherCacheMins").Value;
        string result;
        if(cacheMins == 0)
        {
            result = RenderPage("~/macroScripts/Weather/WeatherFeed.cshtml").ToHtmlString();
        }
        else
        {
            result = WebCache.Get(cacheKey);
            if(result == null || !string.IsNullOrEmpty(Request.QueryString["refreshWeather"]))
            {
                result = RenderPage("~/macroScripts/Weather/WeatherFeed.cshtml").ToHtmlString();
                WebCache.Set(cacheKey, result, cacheMins, false);
            }
        }
    }
        @Html.Raw(result)   
    @{
        
        var mediaNode = NodeTools.GetFirstAnscestorOrSelfWithProperty(PageState.Get().GetHomePage(), "splashImages");      
        if (mediaNode != null)
        {
            var imageId = Util.PickRandomMedia(int.Parse(mediaNode.GetProperty("splashImages").Value));
            if(imageId != null)
            {
            var image = new Media(imageId.Value);
            <img alt="" class="SplashImage" src="/[email protected](image.getProperty("umbracoFile").Value.ToString())&width=987&height=200"/>            
            }
        }
         
        }
        </div>
        <!-- banner ends -->

Please Sign in or register to post replies

Write your reply to:

Draft