Skip to content

Instantly share code, notes, and snippets.

@contensis
contensis / query-methods.cs
Created May 20, 2014 14:30
How to use Web API Search query methods.
@using Contensis.Framework.Web
@using Contensis.Framework.Web.Search
@{
var query = Query.Where("Property_Path").StartsWith("/Products/Books/").Or("Property_Path").StartsWith("/Products/Toys/");
var nodes = new NodeFinder().Find(query);
}
<h1>Search Results</h1>
<ul>
@foreach(var node in nodes){
@contensis
contensis / LocalViewMenu.cs
Created May 21, 2014 14:28
A razor view that mimics the functionality of our local view menu control buts outputs semantic markup and classes that allow for easier and more flexible styling
@using Contensis.Framework.Web
@using Contensis.Framework.Web.Search
@{
var currentFolder = CurrentNode.Parent;
var currentDepth = CurrentNode.Parent.Depth;
}
<ul class="sys_menu">
//Need to get the homepage for all parent folders
@contensis
contensis / mime_type_configuration.xml
Last active October 1, 2020 08:29
How to configure MIME types within web.config.
<?xml version="1.0"?>
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".vtt" mimeType="text/vtt" />
<mimeMap fileExtension=".srt" mimeType="text/srt" />
<mimeMap fileExtension=".aac" mimeType="audio/aac" />
<mimeMap fileExtension=".oga" mimeType="audio/ogg" />
<mimeMap fileExtension=".mp4" mimeType="video/mp4" />
<mimeMap fileExtension=".webm" mimeType="video/webm" />
'-----------------------------------
' Contensis - Custom Code (Page PreLoad)
'
' Add to your base template
'
' Append the content version number to CSS Link URL to prevent caching
' e.g. <link href="/siteelements/assets/css/main.css?version=81002" rel="stylesheet" type="text/css" />
'
'-----------------------------------
@contensis
contensis / Load Structured Content Image (VB.NET)
Created July 9, 2014 11:48
Load Structured Content Image
Dim imageNode As Node = GetNodeByContentId(imageContentId)
@If imageNode IsNot Nothing Then
@<div class="sys_article-image"><img src="@imageNode.FullPath" alt="@imageNode.Title" /></div>
End If
@Functions
Function GetNodeByContentId(contentId As Integer) As Node
@contensis
contensis / package.xml
Created July 14, 2014 08:44
Example package.xml file for the marketplace.
<?xml version="1.0" encoding="utf-8" ?>
<package id="004EF005-90F8-4824-9B59-E2BCED2C32C3"
name="MyNewPackage"
version="1.000"
displayName="My New Package!">
<controls>
<control packagePath="/razor/Razor1.cshtml" name="Razor1" showInMenu="true" viewingGroup="1">
<properties>
<text name="prop1" description="Razor1 Prop1" />
@contensis
contensis / cms-content.xml
Created July 14, 2014 08:46
A sample cms-content.xml file for the marketplace.
<root>
<configuration>
<custompropertydefinitions>
<custompropertydefinition name="OriginalWizardFolderID" typename="System.Int32" />
<custompropertydefinition name="LGNL_Id" typename="System.String" />
<custompropertydefinition name="LGNL_IsDefault" typename="System.Boolean" />
</custompropertydefinitions>
<templates />
<relationshiptypes />
</configuration>
@contensis
contensis / MyPackageData.xml
Created July 14, 2014 11:38
Custom Structured Content Type within a marketplace package.
<?xml version="1.0" encoding="utf-8" ?>
<module name="Test" moduleID="28949B9F-0383-4C01-8CFA-7B885DD49D56" version="1.0" sqlTableName="MyPackage" featureName="MyPackage">
<references>
<reference name="CMS_API.WebUI.WebControls.SimpleControls.dll" />
<reference name="CMS_API.CmsUI.WebControls.dll" />
<reference name="CMS_API.WebUI.WebControls.dll" />
<reference name="Telerik.Web.UI.dll" />
</references>
<fieldset>
<field name="Text" type="ntext" options="CMSHtml, SaveToHtmlContent" />
@contensis
contensis / web-control-literals
Created July 18, 2014 14:13
Custom code for changing the values of a web control based on localised literals.
if CurrentNode.Language= 1 then
Listing.title = "Find an event"
Listing.noresultstext = "Sorry, no events found"
else if CurrentNode.Language= 8 then
Listing.title = "Chwilio am ddigwyddiad"
Listing.noresultstext = "Dim digwyddiadau"
end if
@contensis
contensis / MyPackageData.xml
Created July 23, 2014 08:50
Custom Structured Content Type within a marketplace package.
<?xml version="1.0" encoding="utf-8" ?>
<module name="Test" moduleID="28949B9F-0383-4C01-8CFA-7B885DD49D56" version="1.0" sqlTableName="MyPackage" featureName="MyPackage">
<references>
<reference name="CMS_API.WebUI.WebControls.SimpleControls.dll" />
<reference name="CMS_API.CmsUI.WebControls.dll" />
<reference name="CMS_API.WebUI.WebControls.dll" />
<reference name="Telerik.Web.UI.dll" />
</references>
<fieldset>
<field name="Text" type="ntext" options="CMSHtml, SaveToHtmlContent" />