Skip to content

Instantly share code, notes, and snippets.

@iso100
iso100 / Conditional Secondary Nav with Structure
Created May 24, 2013
Failed attempt at only rendering secondary navigation when there's nav items to display.
View Conditional Secondary Nav with Structure
{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
Remove trailing slash from URLs
View .htaccess
# 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
A quick rss feed template for Statamic.
View statamic_feed_template.html
<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 Apr 24, 2013
Ian's mods to breadcrumbs allowing a custom last class to support Foundation 4
View mod.structure.php
/** -------------------------------------
/** Create a Breadcrumb Trail
/** -------------------------------------*/
function breadcrumb()
{
$site_pages = $this->sql->get_site_pages();
if ( ! $site_pages)
return FALSE;
View .htaccess
#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 Mar 18, 2013
Example Editor Styles for Wygwam
View wygwam_styles.js
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 Feb 24, 2013
Sample code for Gareth that I'm using to size images used in a gallery.
View Statamic Gallery
@iso100
iso100 / GAOutboundTracking
Created Jan 10, 2013
Outbound link tracking with Google Analytics with special support for opening new tabs
View GAOutboundTracking
// 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 Oct 9, 2012
Related entries in Statamic via taxonomy tags
View related_entries.html
@iso100
iso100 / pi.list_linker.php
Created Dec 11, 2012
Plugin to create href links from delimited text
View pi.list_linker.php
<?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