Skip to content

Instantly share code, notes, and snippets.

View nils-werner's full-sized avatar

Nils Werner nils-werner

View GitHub Profile
@nils-werner
nils-werner / field.date.php
Created November 29, 2010 10:35
Original Version
<?php
Class fieldDate extends Field{
const SIMPLE = 0;
const REGEXP = 1;
const RANGE = 3;
const ERROR = 4;
private $key;
public function grab(&$param_pool=NULL){
// I am not able to access $param_pool, so I'm taking a detour via Frontend::Page()
$page = Frontend::Page();
// CREATE XML DOCUMENT
$doc = new DOMDocument;
$root = $doc->createElement($this->dsParamROOTELEMENT);
$doc->appendChild($root);
// APPEND ARTICLES
<ul>
<xsl:apply-templates select="/data/categories/entry[not(parent)]" />
</ul>
<xsl:template match="categories/entry">
<xsl:param name="path" select="''" />
<li id="{title/@handle}">
<a href="{$root}{$path}{title/@handle}/">
<xsl:value-of select="title" />
@nils-werner
nils-werner / loop.xsl
Created May 22, 2010 17:31
XSLT Loop
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
exclude-result-prefixes="xsl">
<xsl:template name="loop"> <!-- Loop -->
<xsl:param name="i" />
<xsl:param name="limit" />
<xsl:call-template name="loop-item">