Skip to content

Instantly share code, notes, and snippets.

@iso100
iso100 / Conditional Secondary Nav with Structure
Created May 24, 2013 18:29
Failed attempt at only rendering secondary navigation when there's nav items to display.
{if '{structure:child_ids_for:{structure:top:entry_id}}' != ''}
<div id="secondary-nav" class="widget">
<h3>Other Pages in <a href="{structure:top:uri}">{structure:top:title}</a>:</h3>
{exp:structure:nav
current_class="active"
start_from="/{segment_1}"
include_ul="yes"
}
</div>
{/if}
@iso100
iso100 / .htaccess
Created May 4, 2013 18:04
Remove trailing slash from URLs
# Remove Trailing Slash
# ------------------------------
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} (.*)$
RewriteRule ^(.+)/$ http://www.yourdomain.com/$1 [R=301,NC,L]
@iso100
iso100 / statamic_feed_template.html
Created May 1, 2013 12:50
A quick rss feed template for Statamic.
<channel>
<title><![CDATA[{{ folder }}]]></title>
<link>{{ _site_url }}/{{ folder }}</link>
<description>{{ _site_name }} {{ folder }}</description>
<dc:language>en-us</dc:language>
<dc:creator>{{ contact_email }}</dc:creator>
<dc:rights>Copyright {{ current_date format='Y' }}</dc:rights>
<dc:date>{{ current_date format="Y-m-d\TH:i:s\Z" }}</dc:date>
<admin:generatorAgent rdf:resource="http://statamic.com/" />
@iso100
iso100 / mod.structure.php
Created April 24, 2013 01:19
Ian's mods to breadcrumbs allowing a custom last class to support Foundation 4
/** -------------------------------------
/** Create a Breadcrumb Trail
/** -------------------------------------*/
function breadcrumb()
{
$site_pages = $this->sql->get_site_pages();
if ( ! $site_pages)
return FALSE;
#added by Nevin Lyne - DoS protection against /entry/vote-ajax URL
Redirect 403 /entry/vote-ajax
RewriteEngine On
RewriteBase /
# For SLP Site
RewriteCond %{HTTP_HOST} ^slp.pbinsight.com$
RewriteCond %{REQUEST_FILENAME} !slp/
RewriteRule ^(.*)$ slp/$1
@iso100
iso100 / wygwam_styles.js
Created March 18, 2013 20:15
Example Editor Styles for Wygwam
CKEDITOR.stylesSet.add( 'editor_styles',
[
// Block Styles
//{ name: 'Blue Title', element: 'h2', styles: { 'color': 'Blue' } },
{ name: 'Legal Text', element: 'p', attributes: { 'class': 'legal' } },
{ name: 'CTA Button', element: 'a', attributes: { 'class': 'ctabutton' } },
{ name: 'Citation', element: 'span', attributes: { 'class': 'cite' } },
@iso100
iso100 / Statamic Gallery
Created February 24, 2013 15:40
Sample code for Gareth that I'm using to size images used in a gallery.
@iso100
iso100 / GAOutboundTracking
Created January 10, 2013 17:46
Outbound link tracking with Google Analytics with special support for opening new tabs
// Track outbound links in GA via events
$("a").on('click',function(e){
var url = $(this).attr("href");
var target = $(this).attr("target");
if (e.currentTarget.host !== window.location.host) {
var newtab;
try {
_gaq.push(['_trackEvent', 'Outbound Links', e.currentTarget.host, url, 0]);
} catch(err) {}
if (target || e.metaKey || e.ctrlKey) { // If there's a target specified or if the user is holding down a new tab key
@iso100
iso100 / related_entries.html
Created October 9, 2012 01:06
Related entries in Statamic via taxonomy tags
@iso100
iso100 / pi.list_linker.php
Created December 11, 2012 16:44
Plugin to create href links from delimited text
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* List Linker Plugin
*
* @package ExpressionEngine
* @subpackage Addons
* @category Plugin
* @author Adam Wiggall
* @link http://turnandface.com