Skip to content

Instantly share code, notes, and snippets.

@ps-team
ps-team / Separate events filter custom code
Created October 27, 2017 10:02
HTML and Custom code to create a separate events filter
Dim eventsFilter as string = Request.QueryString("EventsCalendar_EventDateSpan")
If Request.QueryString.Count > 0 AndAlso Request.QueryString("EventsCalendar_EventDateSpan") IsNot Nothing Then
Select True
Case eventsFilter.Contains("All")
eventsFilterAll.attributes("class") = "sys_selected"
Case eventsFilter.Contains("Today")
eventsFilterToday.attributes("class") = "sys_selected"
@ps-team
ps-team / EventsListItemTemplate.cshtml
Created October 27, 2017 10:01
Events list item template with multiple categories
<h2 class="sys_subitem-heading sys_events-subheading"><a href="@CurrentNode.Path">@CurrentNode.Title</a></h2>
<div class="sys_subitem-summary sys_events-summary">
@if(CurrentNode.Data.Property_TaxonomyCategories.ToString() != ""){
string[] eventCategoriesTax = CurrentNode.Data.Property_TaxonomyCategories.ToString().Split(',');
string lastCategory = eventCategoriesTax[eventCategoriesTax.Length - 1];
string eventCategoriesString = "";
foreach (string eventCategory in eventCategoriesTax) {
if(eventCategory.Contains("0/4/11/12")) {
@ps-team
ps-team / News mini list
Created October 27, 2017 10:01
News mini list with dates in razor
@using Contensis.Framework.Web
@using Contensis.Framework.Web.Search
@{
var newsArticlesQuery = Query.Where("SC_T_ID").IsEqualTo("-1025").OrderBy("Property_DatePublished").Descending; /* add template id for news here */
var newsArticles = new NodeFinder().Find(newsArticlesQuery, selectCount:3);
var utils = new CMS_API.Common.BaseUtilities();
}
<div class="sys_miniList sys_miniListNews">
@ps-team
ps-team / Events mini list
Created October 27, 2017 10:00
Events mini list
@using Contensis.Framework.Web
@using Contensis.Framework.Web.Search
@{
var newsArticlesQuery = Query.Where("SC_T_ID").IsEqualTo("-258875"); /* add template id for news here */
var newsArticles = new NodeFinder().Find(newsArticlesQuery);
var utils = new CMS_API.Common.BaseUtilities();
var currentDate = DateTime.Today;
@ps-team
ps-team / TopMenu.cs
Created October 27, 2017 10:00
A top menu navigation razor that allows user to set which page they want to appear using a meta data tag. Also show the next level down.
@using Contensis.Framework.Web
@using Contensis.Framework.Web.Search
@{
FolderNode topFolder = null;
//Always get the current top folder regardless of depth of the current page
if(CurrentNode.Parent.Depth > 1) {
topFolder = CurrentNode.Parent.AncestorAtDepth(1);
}else{
@ps-team
ps-team / Get Author Name Email etc.vbs
Created October 27, 2017 09:59
Get Author Name Email etc
Dim authorId As String = item.Data("AuthorId")
Dim user As New CMS_API.Security.User(authorId)
Dim authorName As String = user.FirstName
@ps-team
ps-team / Hiding placeholders.vbs
Created October 27, 2017 09:58
Hiding placeholders - simple stuff, but there are bits here that can be quite useful
// Hide a placeholder if it is empty
If Control.controls.count = 0 then
If value.trim.toLower.indexof("[add content here]") > -1 Or StripHTML(HttpUtility.HTMLDecode(value).trim).length = 0 then
Control.visible = false
End If
End If
// Hide a placeholder if it is empty, also adding in a check for images.
@ps-team
ps-team / CustomUtilities.cs
Last active October 27, 2017 09:57
A set of custom utility functions for use in App_code
using System;
using System.Web;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using Contensis.Framework.Web;
using Zengenti.Contensis.Delivery;
using Zengenti.Contensis;
using Zengenti.Populo;
@ps-team
ps-team / breadcrumbs-combined.cshtml
Created October 27, 2017 09:56
Razor breadcrumbs that work with both legacy content pages AND entries - requires customUtilities.cshtml (another gist)
@using Contensis.Framework.Web;
@using System.Web;
@{
// check if this is an entry
var entryUrl = "";
var entryTitle = "";
if (HttpContext.Current.Items["entryUrl"] != null)
{
entryUrl = HttpContext.Current.Items["entryUrl"].ToString();
@ps-team
ps-team / Breadcrumb.cshtml
Created October 27, 2017 09:52
Contensis Razor Breadcrumb - webAPI only
@using Contensis.Framework.Web;
<ul>
<li>
You are here:
</li>
@breadcrumb(CurrentNode)
@helper breadcrumb(Node node)
{