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
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 -->
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
hi Graeme,
Could you show your templates? You can use your master pages, I think.
Thanks, Alex
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 -->
is working on a reply...