Skip to content

Instantly share code, notes, and snippets.

cheralynnadal

Block or report user

Report or block cheralynnadal

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Scripts
<!-- Responsive Menu -->
<link rel="stylesheet" href="/css/slicknav.css">
<script src="/scripts/jquery.slicknav.js"></script>
View TopNavigation.cshtml
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
if (Model.Content.AncestorOrSelf(1).Children.Any())
{
<ul id="menu">
@foreach (var mainNodes in Model.Content.AncestorOrSelf(1).Children.Where("addToMainNavigation= true").Where(x => x.TemplateId != 0 && x.IsVisible()))
{
if (mainNodes.Children.Where("addToMainNavigation= true").Any(x => x.TemplateId != 0 && x.IsVisible()))
{
<li class="@Umbraco.If(mainNodes.IsAncestorOrSelf(Model.Content), "active", null)">
View display associated content by current node ID
@{
Layout = "Master.cshtml";
var currentNode = CurrentPage.Id.ToString(); // Get the current node ID
var allContentAssociations = Umbraco.TypedContentAtXPath("//docTypeAlias"); // Get the document type alias
}
<div class="container">
@foreach (var contentAssociation in allContentAssociations)
{
var myDataType = contentAssociation.GetPropertyValue("dataTypeAlias"); // get the content picker data type alias
var convertDataTypes = Convert.ToString(myDataType);
View Display repeating strings in Umbraco 7.6
@{
if (Model.Content.GetPropertyValue<string[]>("repeaterAlias").Length > 0)
{
@foreach (var item in Model.Content.GetPropertyValue<string[]>("repeaterAlias"))
{
<p>@item</p>
}
}
}
View Displaying multiple media items in Umbraco 7.6
@{
var myImageList = Model.Content.GetPropertyValue<IEnumerable<IPublishedContent>>("dataTypeAlias");
if (Model.Content.HasValue("dataTypeAlias"))
{
@foreach (var myImage in myImageList)
{
<div class="img-container">
<img src="@myImage.Url">
</div>
}
@cheralynnadal
cheralynnadal / Display image with ALT tag from Media Library
Created Feb 16, 2017
Display image with ALT tag from Media Library
View Display image with ALT tag from Media Library
@{
if (CurrentPage.HasValue("mainImage")){
var dynamicMediaItem = Umbraco.Media(CurrentPage.mainImage);
<img src="@dynamicMediaItem.umbracoFile" alt="@dynamicMediaItem.altText" style="display:block;margin:0 auto 5%; width: 100%;"/>
}
}
View relatedPosts
View Umbtuts - Responsive Menu
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
<!-- nav-collapse -->
@{
if (Model.Content.AncestorOrSelf(1).Children.Any()) {
<ul id="menu">
@foreach (var mainNodes in Model.Content.AncestorOrSelf(1).Children.Where("addToMainNavigation= true").Where(x => x.TemplateId != 0 && x.IsVisible()))
{
if (mainNodes.Children.Where("addToMainNavigation= true").Any(x => x.TemplateId != 0 && x.IsVisible()))
{
View uprise-part5
<!DOCTYPE html>
<html>
<head>
<title>Parlez Vous Code?</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="description" content="Do you know your CSS from your HTML? upriseVSI know" />
<meta name="author" content="upriseVSI www.uprisevsi.co.uk" />
<meta name="viewport" content="width=device-width,initial-scale=1">
</head>
<body>
You can’t perform that action at this time.