Skip to content

Instantly share code, notes, and snippets.

Sebastiaan Janssen nul800sebastiaan

Block or report user

Report or block nul800sebastiaan

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
@nul800sebastiaan
nul800sebastiaan / Umbraco RSS feed example
Created Apr 20, 2011
Replace "//Article" with the nodeTypeAlias of which you want to create RSS items. Note that the "bodyText" property alias is being used for the article content.
View Umbraco RSS feed example
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
exclude-result-prefixes="msxml umbraco.library">
@nul800sebastiaan
nul800sebastiaan / gist:1042579
Created Jun 23, 2011
Conditional sorting for XSLTSearch 1.0
View gist:1042579
<xsl:choose>
<xsl:when test="umbraco.library:RequestQueryString('sortbydate') != ''">
<xsl:for-each select="$matchedNodes">
<!-- sort on the page score of the node, within ALL the nodes to return (the sorting must happen before choosing the nodes for this page) -->
<xsl:sort select="@createDate" order="descending"/>
<!-- only the nodes for this page -->
<xsl:if test="position() &gt;= $startMatch and position() &lt;= $endMatch">
<xsl:call-template name="postlist" />
</xsl:if>
<xsl:comment/>
@nul800sebastiaan
nul800sebastiaan / RenderArticleList.xslt
Created Jun 28, 2011
XSL Parameter doesn't work in a choose?!
View RenderArticleList.xslt
<xsl:template name="renderArticleList">
<xsl:param name="orderByPopularity"/>
<xsl:param name="addShowInLatestNewsList"/>
<xsl:choose>
<xsl:when test="$orderByPopularity = 'true'">
== <xsl:value-of select="$addShowInLatestNewsList" /> ==
<!--
@nul800sebastiaan
nul800sebastiaan / RemovePreviewButton.cs
Created Jul 4, 2011
Remove preview button in Umbraco
View RemovePreviewButton.cs
using System;
using umbraco.BusinessLogic;
using umbraco.presentation.masterpages;
namespace SomeCompanyName.EventHandlers
{
public class RemovePreviewButton : ApplicationBase
{
public RemovePreviewButton()
{
@nul800sebastiaan
nul800sebastiaan / gist:1067257
Created Jul 6, 2011
Grouping in Razor (Umbraco 4.7.1)
View gist:1067257
@foreach(var group in Model.Children.InGroupsOf(2))
{
<div class="row-of-two">
@foreach(var item in group)
{
<span>@item.Name</span>
}
</div>
}
View first-attempt.cshtml
@helper RenderCountryOptions() {
<option>Choose a country...</option>
@foreach(var region in @Model.XPath("/root/Website/CountryList/CountryList[Country[not(active = 0)]]"))
{
<optgroup label="@region.Name">
@foreach(var country in @region.Children)
{
<option>@country.Name</option>
}
</optgroup>
@nul800sebastiaan
nul800sebastiaan / gist:1170848
Created Aug 25, 2011
Get a specific crop using Umbraco 4.7.1 Razor engine
View gist:1170848
Given this XML:
<NewsItem id="1140" parentID="1139" level="3" writerID="0" creatorID="0" nodeType="1137" template="1138" sortOrder="1" createDate="2011-08-10T13:46:53" updateDate="2011-08-25T16:51:18" nodeName="Test newsitem" urlName="test-newsitem" writerName="admin" creatorName="admin" path="-1,1051,1139,1140" isDoc="">
<categories><![CDATA[allergy]]></categories>
<introText><![CDATA[Minime vero, inquit ille, consentit. Quod si ita se habeat, non possit beatam praestare vitam sapientia.]]></introText>
<bodyText><![CDATA[
<p>Ipsum.</p>
]]></bodyText>
<imageUpload>/media/2209/tulips.jpg</imageUpload>
<imageCrop>
@nul800sebastiaan
nul800sebastiaan / EditPage.aspx
Created Sep 16, 2011
Adding save button to custom tree editpage
View EditPage.aspx
<%@ Page Language="C#" MasterPageFile="../../masterpages/umbracoPage.Master" AutoEventWireup="True" CodeBehind="EditPage.aspx.cs" Inherits="SomeCompany.CustomTrees.EditPage" %>
<%@ Register Namespace="umbraco.uicontrols" Assembly="controls" TagPrefix="umb" %>
<asp:Content ID="Content" ContentPlaceHolderID="body" runat="server">
<umb:UmbracoPanel ID="Panel1" runat="server" hasMenu="true" Text="Edit Group">
<umb:Pane ID="Pane1" runat="server">
<umb:PropertyPanel ID="PPanel0" runat="server" Text="Name">
<asp:TextBox ID="Name" runat="server" MaxLength="150" CssClass="guiInputText guiInputStandardSize"></asp:TextBox>
</umb:PropertyPanel>
@nul800sebastiaan
nul800sebastiaan / gist:1241761
Created Sep 26, 2011
Modify the body tag with Razor in Umbraco
View gist:1241761
<umbraco:Macro runat="server" Language="cshtml">
<body class="@Model.NodeTypeAlias.ToLower().Replace(" ", "-")">
</umbraco:Macro>
View gist:1250799
<xsl:variable name="myBoolean" select="$currentPage/prop = '1'" />
<!-- Doesn't work! -->
<xsl:value-of select="myTest:GetResult($myBoolean)" />
<!-- Works.. -->
<xsl:value-of select="myTest:GetResult($currentPage/prop = '1')" />
You can’t perform that action at this time.