Skip to content

Instantly share code, notes, and snippets.

View leekelleher's full-sized avatar
:shipit:
Umbraco v14 RC1 full steam ahead!

Lee Kelleher leekelleher

:shipit:
Umbraco v14 RC1 full steam ahead!
View GitHub Profile
@leekelleher
leekelleher / 1-README.md
Last active August 29, 2015 14:06
Ditto - Example of mapping an Archetype property to custom POCO model/type

Here is an example of using Ditto to map an Archetype property to custom POCO model/type.


Let's say that we have an Archetype to represent some SEO meta-data, and we'll call the DocType property "metaData".

We'd have 3 properties in the Archetype:

  • metaTitle
  • metaDescription

The following code is intended for use as an overloaded extension for the GetPropertyValue<T>(string alias, bool recurse) method when getting strongly typed values back.

This example uses Archetype where in Umbraco v7.1.8 calling such a property value recursively returns an ArchetypeModel with 0 fieldsets.

There could be other possible applications for allowing a developer to determine the logic when GetPropertyValue(string alias, bool recurse) is trying to get a value recursively but accepts it.

@leekelleher
leekelleher / _media.xslt
Created February 23, 2011 11:14
Generic XSLT template for Media items in Umbraco
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp "&#x00A0;">
]>
<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"
exclude-result-prefixes="msxml umbraco.library">
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:umbraco.library="urn:umbraco.library"
exclude-result-prefixes="umbraco.library">
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes" />
<xsl:param name="currentPage" />
<xsl:variable name="separator" select="string('|')" />
@leekelleher
leekelleher / wordpress-upgrade.sh
Created March 13, 2011 15:39
Upgrade WordPress Shell Script
#!/bin/sh
# WordPress Update Script
# Written by: Lee Kelleher
# Released: 2008-04-23
# Email: lee # at # vertino # dot # net
# Released under GPL
echo "Downloading current version of WordPress..."
wget http://wordpress.org/latest.tar.gz
@leekelleher
leekelleher / Dashboard.config.xml
Created March 16, 2011 12:26
Adds the uComponents installer (activator) as a dashboard control in the Umbraco back-office.
<?xml version="1.0" encoding="utf-8" ?>
<dashBoard>
<section alias="uComponentsInstaller">
<areas>
<area>developer</area>
</areas>
<tab caption="uComponents: Activator">
<control>/umbraco/plugins/uComponents/uComponentsInstaller.ascx</control>
</tab>
</section>
@leekelleher
leekelleher / UmbracoDumpContent.xslt
Created April 4, 2011 16:22
Dump out all content pages from Umbraco in XSLT.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp "&#x00A0;">
]>
<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"
exclude-result-prefixes="msxml umbraco.library">
@leekelleher
leekelleher / PaginationExample.xslt
Created August 3, 2011 08:08
Generic XSLT template for pagination with Umbraco
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp "&#x00A0;">
]>
<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"
exclude-result-prefixes="msxml umbraco.library">
@leekelleher
leekelleher / RedirectToFirstChild.master
Created August 24, 2011 15:55
Umbraco template to redirect the current page/node to its first child page/node.
<%@ Master Language="C#" MasterPageFile="~/masterpages/BlankTemplate.master" AutoEventWireup="true" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
var current = umbraco.NodeFactory.Node.GetCurrent();
if (current != null)
{
var child = current.ChildrenAsList.FirstOrDefault();
if (child != null)
{
@leekelleher
leekelleher / ExternalLink.master
Created September 22, 2011 15:48
Umbraco template to redirect to an external URL, (set as a property on the current page/node).